zoukankan      html  css  js  c++  java
  • 复选框全选反选问题

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

  • 相关阅读:
    响应式布局
    CSS3过渡
    CSS3背景
    CSS渐变
    CSS3选择器
    CSS3
    自定义指令
    键盘修饰符
    过滤器
    v-if与v-show区别
  • 原文地址:https://www.cnblogs.com/shuo1208/p/7058113.html
Copyright © 2011-2022 走看看