forked from marquez.juan/clase-8-DOM
feat: add addItem function to append new items to the list
This commit is contained in:
@@ -15,3 +15,12 @@ const addClass = (a) => {
|
||||
item.classList.add(a);
|
||||
});
|
||||
}
|
||||
|
||||
// Ejercicio 3
|
||||
|
||||
const addItem = (a) => {
|
||||
const list = document.querySelector('ul');
|
||||
const newItem = document.createElement('li');
|
||||
newItem.textContent = a;
|
||||
list.appendChild(newItem);
|
||||
}
|
||||
Reference in New Issue
Block a user