jquery 复选框全选与取消选中

时间:2017-10-09 10:45:34   收藏:0   阅读:243
$("th").on(‘click‘,‘#checkboxHead‘,function(){
var temp= $("#checkboxHead").is(‘:checked‘);
// alert(temp);
if(temp==true){
//alert("选中");
$("td input[type=‘checkbox‘]").each(function(){
// 复选框打勾
$(this).prop("checked",true);

});
}
else
{ // 复选框取消打勾
$("td input[type=‘checkbox‘]").each(function(){
$(this).removeAttr("checked");
// $(this).attr("checked",false);
});
}
});

原文:http://www.cnblogs.com/yanglife/p/7639869.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!