ob1kanobee
Programmer
I have an Add button that creates textboxes within a loop and declaring an onchange event call on the fly, but when I execute the code by clicking the Add button, it automatically goes to the validateAddress function which is supposed to validate an email address.
What am I doing wrong to cause it to fire off the validateAddress function when it builds the textbox instead of after I key in a value?
Any help will be appreciated. Thanks
var td5 = document.createElement("TD");
var inp5 = document.createElement("INPUT");
inp5.type='text';
inp5.name='sEmailAddress-'+ index;
inp5.value='';
inp5.onchange=validateAddress(inp5.value);
td5.appendChild(inp5);
td5.align='center';
inp5.width='100';
What am I doing wrong to cause it to fire off the validateAddress function when it builds the textbox instead of after I key in a value?
Any help will be appreciated. Thanks
var td5 = document.createElement("TD");
var inp5 = document.createElement("INPUT");
inp5.type='text';
inp5.name='sEmailAddress-'+ index;
inp5.value='';
inp5.onchange=validateAddress(inp5.value);
td5.appendChild(inp5);
td5.align='center';
inp5.width='100';