首页 > 其他 > 详细

复选框全选反选问题

时间:2017-06-21 11:04:54      阅读:300      评论:0      收藏:0      [点我收藏+]
<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)这种方式有可能只有一次生效,原因不明

复选框全选反选问题

原文:http://www.cnblogs.com/shuo1208/p/7058113.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!