zoukankan      html  css  js  c++  java
  • 实现全选按钮的js代码

                //全选,取消全选
                $(document).on("click","#selection",function(){
                    if($(this).hasClass("selected")==false){
                        $(this).closest(".tablesWrap").find("input[type=checkbox]").prop("checked",true);
                        $(this).addClass("selected");
                    }else{
                        $(this).closest(".tablesWrap").find("input[type=checkbox]").prop("checked",false);
                        $(this).removeClass("selected");
                    }
                });
     
     
    .tablesWrap便是包含所有复选框的类名。
  • 相关阅读:
    for循环
    3.9 作业
    while循环
    深浅拷贝
    条件与判断
    可变与不可变
    与用户交互与运算符
    垃圾回收机制
    【AC自动机】文本生成器
    【AC自动机】最短母串
  • 原文地址:https://www.cnblogs.com/jiaxin/p/5808797.html
Copyright © 2011-2022 走看看