当前位置:网站首页>使用jq实现全选 反选 和全不选-冯浩的博客
使用jq实现全选 反选 和全不选-冯浩的博客
2022-07-06 09:29:00 【冯浩(grow up)】
思路:
首先调用jq文件
当点击全选的时候我们让他全部为true
当点击全不选的时候我们让他全部为false
当点击反选的时候 使用echo循环遍历checked 使用 !取反;
html部分
<input type="checkbox">
<input type="checkbox">
<button >全选</button>
<button >不全选</button>
<button'>反选</button>
js部分
// 点击全选
$('button:first').click(function(){
$(':checkbox').prop('checked',true);
})
// 点击全不选 eq:获取反选按钮
$('button:eq(1)').click(function(){
$(':checkbox').prop('checked',false);
})
// 点击反选
$('button:last').click(function(){
$(':checkbox').each(function(index,item){
item.checked = !item.checked;
})
})
边栏推荐
- 1013. Divide the array into three parts equal to and
- Codeforces Round #803 (Div. 2)A~C
- AcWing——第55场周赛
- Input can only input numbers, limited input
- (POJ - 3685) matrix (two sets and two parts)
- Codeforces Round #798 (Div. 2)A~D
- Write web games in C language
- 875. 爱吃香蕉的珂珂 - 力扣(LeetCode)
- 1855. Maximum distance of subscript alignment
- 顺丰科技智慧物流校园技术挑战赛(无t4)
猜你喜欢
pytorch提取骨架(可微)
Pytorch extract skeleton (differentiable)
C language must memorize code Encyclopedia
顺丰科技智慧物流校园技术挑战赛(无t4)
树莓派4B安装opencv3.4.0
Vs2019 initial use
807. Maintain the urban skyline
QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)
Borg maze (bfs+ minimum spanning tree) (problem solving report)
Write web games in C language
随机推荐
Advancedinstaller installation package custom action open file
Input can only input numbers, limited input
Codeforces Round #799 (Div. 4)A~H
useEffect,函數組件掛載和卸載時觸發
Share an example of running dash application in raspberry pie.
Calculate the time difference
Opencv learning log 26 -- detect circular holes and mark them
Sanic异步框架真的这么强吗?实践中找真理
Problem - 922D、Robot Vacuum Cleaner - Codeforces
MariaDB的安装与配置
Codeforces Round #801 (Div. 2)A~C
C basic grammar
Differential (one-dimensional, two-dimensional, three-dimensional) Blue Bridge Cup three body attack
指定格式时间,月份天数前补零
Radar equipment (greedy)
860. Lemonade change
Discussion on QWidget code setting style sheet
QT实现窗口渐变消失QPropertyAnimation+进度条
Penetration test 2 --- XSS, CSRF, file upload, file inclusion, deserialization vulnerability
树莓派CSI/USB摄像头使用mjpg实现网页摄像头监控