1//Defining a listener for our button, specifically, an onclick handler
2document.getElementById("add").onclick = function() {
3 //First things first, we need our text:
4 var text = document.getElementById("idea").value; //.value gets input values
5
6 //Now construct a quick list element
7 var li = "<li>" + text + "</li>";
8
9 //Now use appendChild and add it to the list!
10 document.getElementById("list").appendChild(li);
11}
12