您的位置:首页 > 其它

复选框全选反选问题

2017-06-21 09:59 239 查看
<script type="text/javascript">
$(function(){
$("#dispatch_btn").click(function(){
var array = [];
$('input[name=chk_list]').each(function(){
if($(this).is(':checked'))
array.push($(this).parent().next().val());
});
console.log(array);
});
});
function allCheck(e){
console.log("%o",e);
if($("#chkall").is(':checked')){
$('input[name=chk_list]').each(function() {
console.log(this);
$(this).prop("checked", true);
});
} else {
$('input[name=chk_list]').each(function() {
console.log(this);
$(this).removeAttr("checked");
});
}
}
</script>


springmvc控制器端可直接用String[]接受数组参数

注意点:

$(this).attr("checked",true)这种方式有可能只有一次生效,原因不明
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: