function CreateBox()
{
var addRowTextNode1 = document.createElement('input');
addRowTextNode1.setAttribute('type','text','name') ;
var x=document.getElementById('form1')
x.appendChild(addRowTextNode1);
myOnChange = new Function("e", "callChange()");
addRowTextNode1.onchange=myOnChange ;
}
function callChange()
{alert('Hi');};
Hope this helps!
Quote:
Originally Posted by daitasri
Hi
I m creating a textbox dynamically on click of a button. I want to attach an onChange event for that textbox.I tried using following code but it does not seem to work.Can anyone suggest a better way to solve my problem. The code i am using is as follows:
- var cell1 = row.insertCell(0);
-
var addRowTextNode1 = document.createElement('input');
-
addRowTextNode1.setAttribute('type','text','name','UI'+iIteration,'id','UI'+iIteration);
-
addRowTextNode1.onChange=function callChange(){alert('Hi');};
-
cell1.appendChild(addRowTextNode1);
Thanks
daitasri