当前位置:网站首页>Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
2022-07-06 16:39:00 【Feng Hao (grow up)】
Ideas :
First call jq file
When we click Select all, we let them all be true
When clicking none of them, we let them all be false
When you click invert Use echo Loop traversal checked Use ! Take the opposite ;
html part
<input type="checkbox">
<input type="checkbox">
<button > Future generations </button>
<button > Not all </button>
<button'> Reverse election </button>
js part
// Click Select all
$('button:first').click(function(){
$(':checkbox').prop('checked',true);
})
// Click none eq: Get inverse selection button
$('button:eq(1)').click(function(){
$(':checkbox').prop('checked',false);
})
// Click invert
$('button:last').click(function(){
$(':checkbox').each(function(index,item){
item.checked = !item.checked;
})
})
边栏推荐
- 去掉input聚焦时的边框
- Research Report on market supply and demand and strategy of China's tetraacetylethylenediamine (TAED) industry
- QT realizes window topping, topping state switching, and multi window topping priority relationship
- Kubernetes cluster deployment
- Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
- It is forbidden to trigger onchange in antd upload beforeupload
- Bidirectional linked list - all operations
- Codeforces Round #799 (Div. 4)A~H
- Spark's RDD (elastic distributed data set) returns a large result set
- Problem - 922D、Robot Vacuum Cleaner - Codeforces
猜你喜欢
第三章 MapReduce框架原理
Hbuilder X格式化快捷键设置
Problem - 922D、Robot Vacuum Cleaner - Codeforces
第五章 Yarn资源调度器
Codeforces Round #797 (Div. 3)无F
Submit several problem records of spark application (sparklauncher with cluster deploy mode)
原生js实现全选和反选的功能 --冯浩的博客
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
业务系统兼容数据库Oracle/PostgreSQL(openGauss)/MySQL的琐事
Click QT button to switch qlineedit focus (including code)
随机推荐
【锟斤拷】的故事:谈谈汉字编码和常用字符集
Tert butyl hydroquinone (TBHQ) Industry Research Report - market status analysis and development prospect forecast
Remove the border when input is focused
QT实现圆角窗口
Codeforces Round #801 (Div. 2)A~C
Spark independent cluster dynamic online and offline worker node
QT实现窗口置顶、置顶状态切换、多窗口置顶优先关系
Browser print margin, default / borderless, full 1 page A4
FLV格式详解
第5章 NameNode和SecondaryNameNode
(POJ - 3186) treatments for the cows (interval DP)
Codeforces - 1526C1&&C2 - Potions
QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)
Summary of FTP function implemented by qnetworkaccessmanager
China tetrabutyl urea (TBU) market trend report, technical dynamic innovation and market forecast
Oneforall installation and use
MariaDB的安装与配置
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
MP4格式详解
AcWing:第56场周赛