//
全选
$( " #ckball " ).bind( " click " , function () {
if ($( this ).attr( " checked " )) {
$( " .lb_two input[type=checkbox] " ).each( function () {
$( this ).attr( " checked " , true );
});
}
else {
$( " .lb_two input[type=checkbox] " ).each( function () {
$( this ).attr( " checked " , false );
});
}
})
$( " #ckball " ).bind( " click " , function () {
if ($( this ).attr( " checked " )) {
$( " .lb_two input[type=checkbox] " ).each( function () {
$( this ).attr( " checked " , true );
});
}
else {
$( " .lb_two input[type=checkbox] " ).each( function () {
$( this ).attr( " checked " , false );
});
}
})
可悲的是,浏览器提示报错。经过google查阅,发现了jquery1.6下不支持attr的使用。最后只能用低版本或者1.6.1版本。
http://stackoverflow.com/questions/5969598/possible-bug-in-jquery-1-6-attrchecked-is-not-working
http://blog.darkthread.net/post-2011-05-13-jquery-1-6-1.aspx