zoukankan      html  css  js  c++  java
  • 全选取消全选

    jq部分

    $(function(){
            $(".xuan").each(function(){
                var a = $(this).next().nextAll()
                var sign = 1;
                for (var i = a.length - 1; i >= 0; i--) {
                    if(a[i].checked==false){
                        var sign = 0;
                    }
                }
                if (sign==0) {
                    $(this).next().prop("checked","");
                }else{
                    $(this).next().prop("checked","checked");
                }
              });
        })
        $(".xuan_inp").each(function(){
            $(this).nextAll().click(function(){
                var a = $(this).parent().children(":eq(1)").nextAll()
                var sign = 1;
                for (var i = a.length - 1; i >= 0; i--) {
                    if(a[i].checked==false){
                        var sign = 0;
                    }
                }
                if (sign==0) {
                    $(this).parent().children(":eq(1)").prop("checked","");
                }else{
                    $(this).parent().children(":eq(1)").prop("checked","checked");
                }
            })
            
        });
        $(".xuan_inp").click(function(){
            var a = $(this).attr("checked");
            if (a=="checked") {
                $(this).nextAll().prop("checked","checked");
            }else{
                $(this).nextAll().prop("checked","");
            }
        })
  • 相关阅读:
    Java自学
    java自学
    每日总结
    每日总结
    每日总结
    每周总结
    每日总结
    每日总结
    每日总结
    每日总结
  • 原文地址:https://www.cnblogs.com/zinging/p/13140516.html
Copyright © 2011-2022 走看看