开发者

Jquery dropdown select issue in Chrome and IE

开发者 https://www.devze.com 2023-03-03 03:45 出处:网络
The following code works in Firefox but not in Chrome and IE. Any idea why? Thanks! $(\'#image_dd option:selected\'开发者_如何学Go).live(\'click\', function() {

The following code works in Firefox but not in Chrome and IE. Any idea why? Thanks!

$('#image_dd option:selected'开发者_如何学Go).live('click', function() {

    alert("TEST 1");

    if ($("#image_dd").val().length) {
          alert("TEST 2");
    }

    return false;

});


IE doesn't pick up "click" for select options (although firefox does!). You will probably need to use the "change" event instead, works fine in ie, chrome and firefox.


I think your trying to bind to the wrong element and event. Try binding your event handler to the select element and using the "change" or "blur" triggers.

0

精彩评论

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