当前位置:网站首页>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;
})
})
边栏推荐
- Problem - 1646C. Factorials and Powers of Two - Codeforces
- 第5章 NameNode和SecondaryNameNode
- Problem - 922D、Robot Vacuum Cleaner - Codeforces
- Raspberry pie 4B installation opencv3.4.0
- Calculate the time difference
- 音视频开发面试题
- Codeforces - 1526C1&&C2 - Potions
- Summary of game theory
- Local visualization tools are connected to redis of Alibaba cloud CentOS server
- How to insert mathematical formulas in CSDN blog
猜你喜欢
简单尝试DeepFaceLab(DeepFake)的新AMP模型
Base dice (dynamic programming + matrix fast power)
OneForAll安装使用
Pull branch failed, fatal: 'origin/xxx' is not a commit and a branch 'xxx' cannot be created from it
Installation and configuration of MariaDB
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
Chapter 5 namenode and secondarynamenode
QT realizes window topping, topping state switching, and multi window topping priority relationship
QT实现圆角窗口
MariaDB的安装与配置
随机推荐
CMake速成
Useeffect, triggered when function components are mounted and unloaded
第6章 Rebalance详解
第5章 消费者组详解
China double brightening film (dbef) market trend report, technical dynamic innovation and market forecast
Effet d'utilisation, déclenché lorsque les composants de la fonction sont montés et déchargés
Browser print margin, default / borderless, full 1 page A4
Chapter 5 detailed explanation of consumer groups
js时间函数大全 详细的讲解 -----阿浩博客
第 300 场周赛 - 力扣(LeetCode)
QT实现窗口渐变消失QPropertyAnimation+进度条
顺丰科技智慧物流校园技术挑战赛(无t4)
两个礼拜速成软考中级软件设计师经验
FLV格式详解
Chapter III principles of MapReduce framework
力扣——第298场周赛
Research Report on market supply and demand and strategy of China's four seasons tent industry
useEffect,函数组件挂载和卸载时触发
Tree of life (tree DP)
Codeforces Round #800 (Div. 2)AC