在多次选择之外释放鼠标时,jQuery更改事件不会在IE中触发 [英] jQuery change event not firing in IE when releasing mouse outside of multiple select

查看:61
本文介绍了在多次选择之外释放鼠标时,jQuery更改事件不会在IE中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我花了一段时间才想出这个问题的标题。

Ok, it took me a while just to come up with a title for this question.

假设您有一个多选列表并使用jQuery来检测改变事件。在正常情况下,这将在Firefox和IE下正常工作。但是在IE中,如果您在列表中选择了某些内容,并且在光标位于select之外之后才释放鼠标,则不会触发该事件。这样做适用于Firefox。

Let's say you have a multiple select list and you use jQuery to detect the change event. This will work fine under Firefox and IE under normal conditions. But in IE, if you select something in the list, and you don't release the mouse until after your cursor is outside of the select, the event will not be fired. Doing that works in Firefox.

HTML:

<select size="4" name="ListBox" multiple="multiple" id="ListBox">
    <option value="32">32</option>
    <option value="48">48</option>
</select>

Javascript:

Javascript:

$(ListBox).change(function ()
{
    alert("Change fired");
});

您可以在此处测试示例: http://jsfiddle.net/as7EN/1/

You can test the example here: http://jsfiddle.net/as7EN/1/

FF 3.6.12:WORKS
IE8:不工作

FF 3.6.12: WORKS
IE8: DOESN'T WORK

感谢您的任何建议。

推荐答案

原来这是一个jQuery 1.4。* bug!

Turns out it's a jQuery 1.4.* bug!

我用早期版本的jQuery 1.3.2再次测试了Fiddle,果然它有效!

I tested the Fiddle again with an earlier version of jQuery, 1.3.2, and sure enough it works!

我在jQuery上发布了一个错误报告,如果你希望他们修复它,请在那里投票我的报告(旁边的票上方有一个非常小的箭头) 上一张票链接):

I posted a bug report at jQuery's, please vote up my report there if you'd like them to fix it (very small arrows above the ticket next to the "Previous Ticket" link):

http: //bugs.jquery.com/ticket/7698

这篇关于在多次选择之外释放鼠标时,jQuery更改事件不会在IE中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆