I´m trying to create a to-do list and struggling with adding entries to the list. I always get the error "list.appendChild is not a function" when clicking on my button even though my list is a DOM element (ul).
function Add(){
var list = document.getElementsByTagName("ul");
var li = document.createElement("li");
var input = document.getElementById("input").value;
var content = document.createTextNode(input);
li.appendChild(content);
list.appendChild(li);
}
Help would be greatly appreciated