Solution Review: Adding a Task in the To-Do List
This review provides a detailed explanation to solve the 'Adding a Task in the To-Do List' challenge.
We'll cover the following...
Solution
Explanation
-
In lines 4-6, we create a
divtask element with the class set totask(line 5) and the text equal to the value of the textbox (line 6). -
In lines 8-9, we create a delete
buttonelement with the id set todelete(line 8) and the class set tofas fa-trash-alt(line 9). -
In lines 11-12, we create a done
buttonelement with the id set todone(line 11) and the class set tofas fa-check(line 12). -
In line 14, we append the delete and the done button elements to the newly created task element.
-
In line 16, we append that task element to the
divwith classnotCompletedand add it to the to-do list. Then the new task element, along with its childrenbuttonelements, is added to the DOM tree and can be seen in the webpage.