how to bind the same event to checkboxes, dropdown select and multiple select components?
there are checkboxes, dropdown select and multiple select components in my webform, I want that they bind the same event that will be triggered when items are check(unchecked) or selectd(unselected), show should do that? Is there a clever and neat way开发者_如何学Python?
you can use the :input to target all the inputs, select, buttons on your site. and then bind the .change() event.
$(":input").bind("change", function() {
//What you want to happen
});
you can even bind more events like click depending on what oyu want to do:
$(":input").bind("change click", function() {
//What you want to happen
});
or if you want specific inputs:
$("input.special, select.myFormSelect, #username").bind("change click", function() {
//What you want to happen
});
精彩评论