I am creating textboxes dynamically using the following code:
[INDENT][COLOR=”Blue”] function AddElement(type,i){ //Add the element specified in the parameter
var value=”Value”;
var element = document.createElement(“input”); //Create an input type dynamically
var newline = document.createElement(“br”); //Create an input type dynamically
element.setAttribute(“type”, type); //Assign different attributes to the element
element.setAttribute(“name”, “vals[]”);
element.setAttribute(“id”, value+i);
element.setAttribute(“value”, value+i);
element.setAttribute(“onblur”,”return IntegerOnly(‘Value”+i+”‘, ‘observation.’)”);
//Append the element in page
var ManInputBoxes = document.getElementById(“spanManualInput”);
ManInputBoxes.appendChild(newline);
ManInputBoxes.appendChild(element);
}[/COLOR][/INDENT]
i create a newline between each text box
I want to have a function that will remove textboxes and the newline that is created. I have the following function to remove the text boxes but I cant remove the new lines that were created so an empty space is left on the page.
[INDENT][COLOR=”blue”] function RemoveElement() {
var d = document.getElementById(‘spanManualInput’);
var oldbox = document.getElementById(‘Value’+i);
d.removeChild(oldbox);
d.removeChild(‘br’);
}
any help is appreciated!