jquery下的正反选操作
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jquery正反选</title>
</head>
<body>
<button onclick='selectall()'>全选</button>
<button onclick="cancel()">取消</button>
<button onclick="reverse()">反选</button>
<table border="1">
<tr>
<td><input type="checkbox"></td>
<td>111</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>222</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>333</td>
</tr>
</table>
<script src="/static/jquery.min.js"></script>
<script>
function selectall() {
$(':checkbox').each(function () {
$(this).prop('checked', true)
}) }
function cancel() {
$(':checkbox').each(function () {
$(this).prop('checked', false)
})
}
function reverse() {
$(':checkbox').each(function () {
if ($(this).prop('checked')){
$(this).prop('checked', false)
}
else {
$(this).prop('checked', true)
}
}) }
</script>
</body>
</html>
jquery下的正反选操作的更多相关文章
- jquery下json数组的操作用法实例
jquery下json数组的操作用法实例: jquery中操作JSON数组的情况中遍历方法用的比较多,但用添加移除这些好像就不是太多了. 试过json[i].remove(),json.remove( ...
- 用jquery来实现正反选选择框checkbox的小示例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- jQuery 全选 正反选
<script src="http://code.jquery.com/jquery-1.4.4.min.js" type="text/javascript&quo ...
- jQuery对下拉框Select操作总结
jQuery对下拉框Select操作总结 转自网络,留做备用 jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change( ...
- jQuery实现全选、全不选以及反选操作
在写购物车案例时实现全选操作使用的是js的getAttribute()setAttribute()方法获取checked属性的值是undefined实现完成之后全选操作,如果在全选中的情况下改变其中一 ...
- jquery checkbox全选,全不选,反选方法,jquery checkbox全选只能操作一次
jquery checkbox全选,全不选,反选方法, jquery checkbox全选只能操作一次, jquery checkbox全选只有第一次成功 >>>>>&g ...
- jQuery下拉框操作系列$("option:selected",this) &&(锋利的jQuery)
jQuery下拉框操作系列$("option:selected",this) &&(锋利的jQuery) <!DOCTYPE html> <ht ...
- jquery对下拉框的操作
jQuery对下拉框的操作 /获取第一个option的值 $('#test option:first').val(); //最后一个option的值 $('#test option:last').v ...
- jquery实现全选、全不选、反选操作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...
随机推荐
- 学习笔记之Everything
Everything (software) - Wikipedia https://en.wikipedia.org/wiki/Everything_(software) Everything is ...
- 个人知识管理PKM:收集、消化、应用、创新
个人知识管理PKM:收集.消化.应用.创新 准备工作1.制作知识分类体系(在线博客分类.本地 ...
- 廖雪峰Java4反射与泛型-2注解-2定义注解
1.定义注解 使用@interface定义注解Annotation 注解的参数类似无参数方法 可以设定一个默认值(推荐) 把最常用的参数命名为value(推荐) 2.元注解 2.1Target使用方式 ...
- SFINAE简单实例
SFINAE(Substitution failure is not an error),是C++11以来推出的一个重要概念,这里,只是简单举一个例子,可能会有人需要. // 添加 scalar nu ...
- Java项目部署服务器操作
有 2个工具需要下载,我使用的是 xshell(操作Linux命令),xftp5(操作文件传输) 需要知道服务器 ip ,账号,密码 xshell连接时,协议选择SSH连接,其他正常输入. xftp5 ...
- [UE4]认识CanvasPanelSlot,Construct Object From Class动态创建UI控件
Canvas Panel Slot是UserWidget的Canvas Panel组件容器内的组件特有的属性. 只有放置在Canvas Panel容器内才会有Canvas Panel Slot属性 可 ...
- RHEL7安装配置VNC
RHEL7安装配置VNC 作者:Eric 微信:loveoracle11g 安装配置VNC服务程序 [root@zhouwanchun yum.repos.d]# cd ~ [root@zhouwan ...
- Linux下安装与卸载anaconda
安装:到安装文件夹的目录下输入 bash Anaconda3-4.1.1-Linux-x86_64.sh 卸载:输入
- plugin 看不到update按钮
然后再按一下tab键,焦点就会在 update上了.然后再回车.
- [深度分析] Python Web 开发框架 Bottle
[深度分析] Python Web 开发框架 Bottle(这个真的他妈的经典!!!) 作者:lhf2009913 Bottle 是一个非常精致的WSGI框架,它提供了 Python Web开发中需要 ...