I have n
number of select lists. n
is dynamic ( depends on the condition and range of n is 1-30). I want to run a jQuery function with .change()
event. Please tell me how can I do that.
Asked
Active
Viewed 46 times
2

Reigel Gallarde
- 64,198
- 21
- 121
- 139

Amit Sarwara
- 573
- 7
- 15
-
1have a look at: http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements – Arun P Johny Jun 09 '14 at 04:33
2 Answers
3
assign same class to all your select lists, say "demo
", and use on change event handler:'
$(document).on('change', '.demo', function() {
//your code here
});

Sudhir Bastakoti
- 99,167
- 15
- 158
- 162
2
You have to give class to all your dropdowns. you can use that class to sence the change event. like
$('.dropdown').change(function(){
});
hope this will help.

satya prakash Sharma
- 31
- 4