hi,

i want two simple functions, one to add a input text field and the other to remove it dynamically.

code i am using:
Code: 
var x=0;
function add() {
var dId = "div"+x;
x++;
 document.getElementById('extra').innerHTML += "<div id=\'"+dId+"\'>URL:<input type='text' name='url[]' value=''><a href=\"javascript:delete('"+dId+"')\">X</a></div><br />";
}
function delete(div) {
var d = document.getElementById('extra');
var d2 = document.getElementById(div);
d.removeChild(d2);
}
the problem is whenever i click the "X" in the generated field box, it opens in new window with some text saying "true", i guess it is an output for the function.
i don't want that output.

and i m using FF4 if it matters.
Arpit15 Reviewed by Arpit15 on . Help Needed With Add and Remove Elements(JS) hi, i want two simple functions, one to add a input text field and the other to remove it dynamically. code i am using: var x=0; function add() { var dId = "div"+x; x++; Rating: 5