IE中的jQuery 1.4更改事件错误 [英] jQuery 1.4 change event bug in IE

查看:99
本文介绍了IE中的jQuery 1.4更改事件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的选择:

<select name="zlecenia_index_icpp" id="items_per_page">  
    <option value="10">10</option>  
    <option value="25" selected="selected">25</option>  
    <option value="50">50</option>  
</select>

上面有:

$('#items_per_page').change(function(){  
    var controller_action = this.name.replace(/_/g, '/');  
    location.href = config.base_url + '/' + controller_action + '/'+this.value;  
});

它曾经在jQuery 1.3中工作,但是在1.4中,单击选择框后便立即触发change事件.除了回到1.3,还有其他解决方案吗?


这似乎确实是一个错误,并且已报告给jQuery:

http://dev.jquery.com/ticket/5869

已应用了一个补丁程序,它将成为jQuery 1.4.1的一部分.

http://github.com/jquery/jquery/commit/435772e29b4ac4ccfdefbc4045d43f714e153381

解决方案

以下是此错误的解决方法: http://github.com/mcurry/jquery/commit/a293f5938eb9efd41158b948f487672d43b7c820 >

希望它会进入1.4.1

I have this simple select:

<select name="zlecenia_index_icpp" id="items_per_page">  
    <option value="10">10</option>  
    <option value="25" selected="selected">25</option>  
    <option value="50">50</option>  
</select>

and on it there's:

$('#items_per_page').change(function(){  
    var controller_action = this.name.replace(/_/g, '/');  
    location.href = config.base_url + '/' + controller_action + '/'+this.value;  
});

It used to work in jQuery 1.3, but in 1.4 the change event is fired as soon as I click on the select box. Is there any solution besides going back to 1.3?


This really seems to be a bug and it has been reported to jQuery:

http://dev.jquery.com/ticket/5869

There has been a patch applied and will be part of jQuery 1.4.1.

http://github.com/jquery/jquery/commit/435772e29b4ac4ccfdefbc4045d43f714e153381

解决方案

Here's fix for this bug: http://github.com/mcurry/jquery/commit/a293f5938eb9efd41158b948f487672d43b7c820

Hopefully it'll get into 1.4.1

这篇关于IE中的jQuery 1.4更改事件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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