Call appendChild on the UL element, not the form element.
Jeff Ober
2009-10-22 14:46:22
Hi
Shouldn't you to append the "li" to the "ul" instead of the form ?
function addTextBox() {
var myUl = document.getElementById('___your_ul_id____
'); <--- change this
myUl.appendChild(document.createElement('li')).innerHTML = "Name ";
}
You need to append the new li to the ul, not the form element.
var ul = document.getElementById("ul_id");
ul.appendChild(document.createElement('li')).innerHTML = "Name <input type=\"text\" name=\"txt\" class=\"txt_input required\">";