I'm doing something like 'to do list'. I want to strike out text on the task but it didn't work so i tried wtih background color or something. `
for(var i=0; i<document.getElementsByClassName('task').length; i++){
document.getElementsByClassName('task')[i].onclick = function(){
this.parentElement.backgroundColor = 'pink';
}
}`
Before that I'm creating new element which have 'task' class. Someone know what am i doing wrong?