+ 1
If you want delete the list get the object , i do it here with example name
A li element ist normaly a child from a <ul>
Lets say the ul object id is listobject:
function clearList() {
var ul = document.getElementById("listobject");
ul.innerHTML = ""
}
And if you want to add single listitems you can do
function addItem() {
var ul = document.getElementById("listobject");
var li = document.createElement("li");
li.appendChild(document.createTextNode("new item"));
ul.appendChild(li);
}
Just asign your onclick event from button to the function
Hope that help you
Happy coding đâïž