该.attr()方法已更改(并且不再适用checked于 > v1.6 中的复选框属性)。
从 jQuery 1.6 开始,.attr() 方法为尚未设置的属性返回 undefined。此外,.attr() 不应用于普通对象、数组、窗口或文档。要检索和更改 DOM 属性,请使用 .prop() 方法。
请改用该.prop()方法(它接受布尔值,而不是字符串)。
$(document).ready(function() {
$('.checkAll').change(function() {
$('.chc').prop('checked', $(this).is(':checked'));
});
$("#slctble").selectable({
filter: 'td',
cancel: 'td:not(.isaretle)',
stop: function() {
$(".ui-selected input", this).each(function() {
this.checked = !this.checked
}); //end-ui-selected input
$('.chc').length == $('.chc:checked').length ? $('.checkAll').prop('checked', true) : $('.checkAll').prop('checked', false);
} //endStopFunction
}); //endSelectable
});
更新了非工作小提琴:http: //jsfiddle.net/dSCfp/1/