<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)这种方式有可能只有一次生效,原因不明

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-07-20
猜你喜欢
  • 2021-10-02
  • 2022-01-23
  • 2022-12-23
  • 2021-06-30
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案