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 = 'file';
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

In order for the event to be triggered, the action must occur, this will only happen when on the page where this textbox is, you change the the value of the textbox

I think you must use onchange, not onChange

More explains at [removed]

no if we using onchange it will not working.. any other suggestion..?

You should post this in javascript forum.

Anyway, you can't use 'this' in dynamically. The only way I have found that works is if you attach an event and use the target part of the trigger event to get the value you are wanting.

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.