DELETE: Remove a Task
The Delete operation removes a task from the list. Create the Delete button:
javascript
function createDeleteButton(li) {
const deleteBtn =
document.createElement("button");
deleteBtn.textContent = "Delete";
deleteBtn.onclick = () =>
handleDeleteClick(li);
return deleteBtn;
}
javascript
function handleDeleteClick(li) {
li.remove();
}
remove() method removes the task from the DOM.
CRUD Operation: DELETE
Sign in to save your progress permanently.
Progress is saved in your browser session
Step 6 of 7