I have created a to-do list, but after shifting a list item from ongoing to completed tab, the tick-mark button created using js is also shifted to completed tab.
I have coded in such a way that every list item created in ongoing tab is binded to tick-mark(class).To remove that button, we need to remove the class i.e. binded to list item.
I have tried:
var nextlist = document.getElementById("completed").getElementsByTagName("li");
var j;
for(j = 0; j < nextlist.length; j++){
nextlist[0].classList.remove("complete");
}
but it does not work. And because this is in HTMLCollection, we cannot use querySelectorAll()
You should replace nextlist[0] to nextlist[j]
var nextlist = document.getElementById("completed").getElementsByTagName("li");
var j;
for(j = 0; j < nextlist.length; j++){
nextlist[j].classList.remove("complete");
}