var input = document.getElementById("userinput");
var button = document.getElementById("button");
var ul = document.querySelector("ul");
button.addEventListener("click", function() {
var li = document.createElement('li');
li.textContent = input.value;
ul.appendChild(li);
input.value = "";
liarray = document.querySelectorAll("li");
li.addEventListener("click", function() {
liarray.pop();
})
})
When I'm running and clicking on an li element, I get an "Uncaught TypeError: liarray.pop is not a function" error message.
Any help? Thanks