关于全选和全部选及个别操作
来源:互联网 发布:c语言某一位取反 编辑:程序博客网 时间:2024/06/08 12:02
<body> <label for="nice1" class="labels"><input type="checkbox" id="nice1" name="nice" class="hello">选项一</label> <label for="nice2" class="labels"><input type="checkbox" id="nice2" name="nice" class="hello">选项二</label> <label for="nice3" class="labels"><input type="checkbox" id="nice3" name="nice" class="hello">选项三</label> <label for="nice4" class="labels"><input type="checkbox" id="nice4" name="nice" class="hello">选项四</label> <label for="nice5" class="labels"><input type="checkbox" id="nice5" name="nice" class="hello">选项五</label> <label for="nice6" class="labels"><input type="checkbox" id="nice6" name="nice" class="hello">选项六</label> <label for="nice7" class="labels"><input type="checkbox" id="nice7" name="nice" class="hello">选项七</label> <label for="nice8" class="labels"><input type="checkbox" id="nice8" name="nice" class="hello">选项八</label> <label for="nice9" class="labels"><input type="checkbox" id="nice9" name="nice" class="hello">选项九</label> <label for="nice10" class="labels"><input type="checkbox" id="nice10" name="nice" class="hello">选项十</label> <label for="all_c" class="all"><input type="checkbox" id="all_c" class="all_c">全选</label><script> $(function(){ $('.hello').click(function(){ var cel=document.querySelectorAll('input[name="nice"]:checked'); console.log(cel.length); if(cel.length==$('.hello').length){ $('.all_c').prop('checked',true); }else{ $('.all_c').prop('checked',false); } }); $('.all_c').click(function(){ if($(this).is(":checked")){ $('.hello').prop('checked',true); }else{ $('.hello').prop('checked',false); } }); })</script>
发现这个querySelectorAll()挺好用的,但是好像兼容不是很好,不过可以学习一下。
阅读全文
0 0
- 关于全选和全部选及个别操作
- checkbox全选和全部选
- 【笔记】关于批量操作的取值和传值及全选反选
- 复选框的全选和全部选
- 全选,及反选,及删除全部,批量删除
- PHP 全选/全部选
- 全选、全部选、反选操作的实现(JS)
- vim全选和全部复制
- 全选,全部选和输入数字对应选的实现
- 全选、全部选、反选
- angular 实现全选、反选、个别选择的实现
- angular 实现全选、反选、个别选择的实现
- 关于VS2008与office2003及和office2007插件个别冲突的解决方案
- 关于VS2008与office2003及和office2007插件个别冲突的解决方案
- 全选和全部取消 复选框
- checkbox 全部选中,和取消全选
- checkbox全选和单选操作
- 关于jqery的全选和反选-
- oj网站的训练题:C基础-公约公倍
- SpringBoot 中文手册 --Part IV --31 缓存
- MapReduce 分组GroupingComparator
- C# Quartz(编码实现定时任务), 干货
- 16.1 字符集与 HTTP
- 关于全选和全部选及个别操作
- H5-Doctype作用
- jdbc进行简单的增删查改(statement)
- react-native的PanResponder详解研究
- 最简单的C++反射
- Consul 环境搭建(单机)
- ArrayList源码分析(基于Java1.8)
- hadoop3.0高可用HA配置详解
- android studio中导入jar 包之后,怎么配置