开发者

jQuery change() event doesn't fire when initial value is reselected

开发者 https://www.devze.com 2023-03-28 23:43 出处:网络
I\'ve bound the jQuery change event to a select box like so: $(\"#select_box\").live(\'change\', function() {

I've bound the jQuery change event to a select box like so:

$("#select_box").live('change', function() {
    selectFunction();
});

I'd like to have selectFunction() run every time a new value is selected. Let's say the initia开发者_StackOverflowl value of the select box is 0. Then a user selects option 1 : change() event fires successfully. But if the user then reselected the initial value of 0, the change() event won't fire. It seems the change event fires on 'change from initial' instead of 'change from previous value' as I'd like.

Is there a good way to do what I'd like?

0

精彩评论

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

关注公众号