I'm looking for a cross-browser way to clear/remove/delete
a dynamically created ul (with li-posts)-list.
created as such: document.createElement("ul");
Is there a truly cross-browser method implemented?
Edit: JQuery not allowed.
I'm looking for a cross-browser way to clear/remove/delete
a dynamically created ul (with li-posts)-list.
created as such: document.createElement("ul");
Is there a truly cross-browser method implemented?
Edit: JQuery not allowed.
// assuming you created your `ul` like this
var ul = document.createElement('ul');
document.body.appendChild(ul);
If you just want to remove its content
// removing only its content
ul.innerHTML = "";
Or you can remove both element and content like this
// removing element and content
ul.parentNode.removeChild(ul);
use removeChild
var createdUL=document.createElement("ul");
createdUL.parentNode.removeChild(ul);
Seems this link might be help you. But remember your question is clear to understand but you have to post some code also to check for the possibilities. Try the following link. JavaScript DOM remove element