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
Post a Comment