bubble_chart StackLab

Todo App HTML + JS + Git + GitHub

7 steps · pending Not started · person_outline Guest
arrow_back Back

DELETE: Remove a Task

The Delete operation removes a task from the list. Create the Delete button:

code javascript
function createDeleteButton(li) {

    const deleteBtn =
        document.createElement("button");

    deleteBtn.textContent = "Delete";

    deleteBtn.onclick = () =>
        handleDeleteClick(li);

    return deleteBtn;
}
Handle the deletion:
code javascript
function handleDeleteClick(li) {

    li.remove();

}
The remove() method removes the task from the DOM. CRUD Operation: DELETE

login Sign in to save your progress permanently. info Progress is saved in your browser session
format_list_numbered Step 6 of 7