HTML:
<ul id="datalist">
</ul>
JavaScript:
function add(content){
ul=document.getElementsByTagName("ul");
var li=document.createElement("li");
li.innerHTML=content;
ul.appendChild(li);
}
When I call add
, Uncaught TypeError: Object #<NodeList> has no method 'appendChild'
is thrown. Any idea why?
jQuery
- Jasper has edited it to replace that withjavascript
instead. – Greco