Task completion for a checklist in JavaScript

Attach an event to the button 'done' in the same way:

let mark = document.createElement('span'); mark.classList.add('mark'); mark.textContent = 'done'; mark.addEventListener('click', function() { // here will be the code for marking the task as done }); li.appendChild(mark);

In order to mark the task as done, you need to attach some CSS class to the corresponding li tag. Let's name, for example, this class - done.

Then for this class you can write the corresponding CSS code:

#list .done { text-decoration: line-through; }

Add the missing part of the code to solve the described problem.

enru