zoukankan      html  css  js  c++  java
  • jquery实现checkbox全选,反选(转载)

    以前网上找到,具体地址忘了

    <script src="jquery.min.js" ></script>
    <script>
         //全选
        function selectAll()
        {//#wx_list是存放checkbox的父元素
            $("#wx_list").find("input[type=checkbox]").each(
                function()
                {
              if(!this.disabled){//排除禁用项   $(
    this).prop("checked", true);
              } } ); countChecked();
    //统计选中项数量 } //反选 function selectInvert() { $("#wx_list").find("input[type=checkbox]").each(function(){this.checked = !this.checked}); countChecked();//统计选中项数量 } //统计选中项数量,在checkbox的onchange属性中也要调用这个函数 function countChecked() {//#msg是一个span $('#msg').text("选中"+$('input[type=checkbox]:checked').length+'项('+(new Date()).toLocaleString()+')');//提示消息+本地时间 } </script>
  • 相关阅读:
    spring注解集合
    spring工作原理理解
    Linux下mysql命令 导入 导出sql文件
    List和Set排序的实现
    LeetCode--树
    LeetCode--链表
    LeetCode--字符串
    LeetCode--贪心算法
    LeetCode--数组
    数据库编程基本练习题
  • 原文地址:https://www.cnblogs.com/nb08611033/p/10112190.html
Copyright © 2011-2022 走看看