Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove btn

function addTask() {
    var node = document.createElement("LI");
    node.textContent = document.getElementById("myTask").value;

    var btn = document.createElement("button");
    btn.textContent = "delete";
    btn.addEventListener('click', () => node.remove());
    node.appendChild(btn);

    document.getElementById("myList").appendChild(node);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #btn
ADD COMMENT
Topic
Name
5+4 =