juery实现checkbox全选
发表于:
来源:阿酷技术学习
作者:simplefastbest
一个需求,当点击一下全选,当再次点击时:取消全选
weibo_buuton_select_all.on('click', function(ev) {
var flag = $(this).prop("checked");
if(flag=='1'){
$(this).prop("checked", '0');
$("input[type=checkbox]").each(function () {
$(this).prop("checked", false);
});
}else{
$("input[type=checkbox]").each(function () {
$(this).prop("checked", true);
});
$(this).prop("checked", '1');
}
});