I’m adding HTML controls dynamically using java script. For instance, I have one button in my page. whenever I click the button, it will create on HTML control in UI page. so, I want to add click event for the controls. Is it possible to get all the UI controls ID?
I’m adding HTML controls dynamically using java script. For instance, I have one button
Share
The probably best solution to your problem is to use event delegate
Suppose you have jQuery (>= 1.7) introduced, things would be simply simple, just add a custom class such as
controlto your control: