开发者

jQuery action whenever any select is changed

开发者_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;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜