更新时间:2023-12-05 12:07:16
您应该在 jQuery 中使用 .prop 方法,因为它会为您进行完整性检查,从而绕过这些烦人的 IE 错误.我可以看到您使用的是 jQuery 1.6,所以这应该可以工作:
You should use the .prop method in jQuery as it does sanity checking for you bypassing these annoying IE errors. I can see you're using jQuery 1.6, so this should work:
$('document').ready(function () {
//get each input that is disabled
$('input').each(function(i, el){
//see if it should be disabled (true|false)
var disabled = $(el).data('disabled');
$(el).prop('disabled', disabled);
});
});
这里是 更新的 jsFiddle 供您查看.