开发者_JS百科Using jQuery, how can I make it so that a function is called whenever any select object on the page is changed?
You can bind the change
event to all the select
elements on the DOM:
$('select').change(function () {
// do something
});
Inside the event handler, the this
keyword refers to the select
element triggered the event, and you can get it's attributes, eg. var selectId = this.id;
精彩评论