javascript checkbox全选和反选的简单实现
作者:lqh 时间:2022-08-31 14:16:32
javascript checkbox全选和反选的简单实现
发现这样写checkbox全选和反选最简洁明了。
function tempUser(val){
$("input[name='userid']").each(function() {
this.checked = val;
});
}
<input type='checkbox' onclick="tempUser(this.checked)" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
<input type='checkbox' name="userid" />
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
来源:http://blog.csdn.net/enterys/article/details/14449763
标签:javascript,checkbox,全选,反选
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
简单聊一聊Java线程池ThreadPoolExecutor
2021-10-23 15:56:58
![](https://img.aspxhome.com/file/2023/3/64053_0s.jpg)
如何修改FeginCilent定义的服务名到指定服务
2022-07-05 05:49:05
关于Mybatis与JPA的优缺点说明
2023-08-23 22:28:33
![](https://img.aspxhome.com/file/2023/0/58450_0s.jpg)
c#学习之30分钟学会XAML
2022-02-08 03:09:52
![](https://img.aspxhome.com/file/2023/7/89837_0s.png)
JDK源码之Vector与HashSet解析
2021-09-06 10:47:23
![](https://img.aspxhome.com/file/2023/4/64144_0s.png)
SpringBoot拦截器的配置使用介绍
2021-06-20 07:25:54
![](https://img.aspxhome.com/file/2023/5/92655_0s.png)
Java流程控制之循环结构for,增强for循环
2023-11-03 10:45:20
![](https://img.aspxhome.com/file/2023/4/58834_0s.jpg)
Java编程实现中英混合字符串数组按首字母排序的方法
2022-03-16 02:34:54
初步编写IDEA\\AndroidStudio翻译插件的方法
2022-12-14 19:30:30
![](https://img.aspxhome.com/file/2023/9/96029_0s.png)
C#计算字符串哈希值(MD5、SHA)的方法小结
2022-07-02 15:47:55
![](https://img.aspxhome.com/file/2023/8/68628_0s.png)
使用@符号让C#中的保留字做变量名的方法详解
2022-06-07 20:22:48
![](https://img.aspxhome.com/file/2023/7/82127_0s.png)
浅谈@Aspect@Order各个通知的执行顺序
2021-10-24 19:00:38
![](https://img.aspxhome.com/file/2023/3/94313_0s.png)
Spring整合junit的配置过程图解
2022-12-18 16:37:48
![](https://img.aspxhome.com/file/2023/5/66975_0s.png)
java 中newInstance()方法和new关键字的区别
2023-11-25 07:17:26
c#爬虫爬取京东的商品信息
2022-12-03 14:38:11
解析ScrollView--仿QQ空间标题栏渐变
2021-06-20 22:44:54
![](https://img.aspxhome.com/file/2023/6/98656_0s.gif)
Java 自定义动态数组方式
2022-08-26 01:38:37
![](https://img.aspxhome.com/file/2023/2/80962_0s.jpg)
SpringBoot 如何添加容器启动的初始化逻辑的操作方法
2021-11-20 12:10:39
![](https://img.aspxhome.com/file/2023/2/79272_0s.png)
shiro之记住登录信息
2023-03-06 18:39:13
Java Pattern与Matcher字符串匹配案例详解
2022-03-25 16:07:19
![](https://img.aspxhome.com/file/2023/7/102627_0s.png)