Hi Folks,

I have created a text box dynamically using javascript. Now i want to call a javascript function in the OnChange Event Of that Control is there any way to do the same.?? Here is the code what i tried.

el[j] = document.createElement('input');
el[j].type = 'text';
el[j].name='work'+j;
el[j].onChange='lookup(this.value)';
//el[j].class='filed';
el[j].className ="field";

In this I written the Onchange Event but its not effecting please try for the same..

Recommended Answers

All 4 Replies

I just replied to your other thread with the same question in the php forums.

I think you must use onchange, not onChange

More explains at

no the onchange also not working any other suggestion please..

hi everybody,
I got the solution for the same... here is the code to do the same..

el[j].onchange=function(){lookup(this);};

This is how we can call a javascript function in dynamic created textbox using javascript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.