jQuery复选框选择在IE中不起作用,并且在Firefox中正常工作

这是我的selectall按钮代码..点击这个我选择所有复选框..

$('#PbtnSelectAll').click(function() { $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked'); $('#PbtnSubmit').show(); $('#PbtnCancel').show(); $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled',true); $('#genericfieldset').find("input,select,textarea").removeAttr('disabled'); }); 

此代码在Firefox中工作,而不是在IE中。 为什么这样做?

检查所有元素的ID。 我将使用.PbtnSelectAll等,并为每个元素提供相同的类。 至少这个类不会像名字那样改变。

尝试使用"#Fieldset input:checkbox"作为选择器。

请尝试使用布尔值

$('#Fieldset input[type=checkbox]').attr('checked',true);

尝试使用true,false boolean。 你能试试http://www.iknowkungfoo.com/blog/index.cfm/2008/7/9/Check-All-Checkboxes-with-JQuery吗?

它在我的IE 7中工作。