javascript - Form of select tags, I want to fire an event if any of them change -


i have form 18 different questions, each 1 has select field options.

my goal time user opens select field , picks option, want ajax call.

my form's id #new-survey, there way put watcher on child elements (the select menus) or similar watch of fields?

note: using jquery

in pure javascript:

var form = document.getelementbyid("new-survey"); var selects = form.getelementsbytagname("select");  (var i=0; i< selects.length; i++) {      selects[i].setattribute("onchange", domyajax); }  function domyajax(e) {  /// ajax content in here } 

in jquery:

$("#new-survey").find("select").change(function(){      // $(this); }); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -