Clearing an Elements DOM
Posted: Sun Mar 04, 2007 11:52 pm
Hey All,
Dont know if the topic title is accurate, but here it goes anyway. I have a textbox in which a user can insert a number and something happens. What I want is to clear all the stuff that has appeared when the textbox value is taken away again.
Thanks.
This is the original action:
Dont know if the topic title is accurate, but here it goes anyway. I have a textbox in which a user can insert a number and something happens. What I want is to clear all the stuff that has appeared when the textbox value is taken away again.
Thanks.
This is the original action:
Code: Select all
function addElement() {
var numba = document.getElementById('calculator').value;
if (numba > 10) {
$('<div style="height:30px;" valign="center" align="center">').append($('<font style="font-family:arial,verdana,sansserif;color:#FFFFFF;font-size:12px">Please enter in a value between 1 and 10</font>')).appendTo("#calcform").attr('id','Div'+counta);
}
var counta = 0;
while (counta < numba) {
$('<div style="height:30px;" valign="center" align="center">').append($('<input type="text" size="8" />')).appendTo("#calcform").attr('id','Div'+counta);
counta++;
}
document.getElementById('calculator').value = "";
}