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 ...
随机推荐
- 解析Javascript事件冒泡机制(转) 本文转自:http://blog.csdn.net/luanlouis/article/details/23927347
本文转自:http://blog.csdn.net/luanlouis/article/details/23927347 1. 事件 在浏览器客户端应用平台,基本生都是以事件驱动的,即某个事件发生,然 ...
- 学习笔记之Python调试 - pdb
python调试神器——pdb - 软谋python https://mp.weixin.qq.com/s/w3Xw8I_zh7MFq2dx5kdQXw 优秀开发者必备技能包:Python调试器 - ...
- [转]SuperSocket
public class SocketServer : AppServer<AppSession> { public SocketServer() : base(new DefaultRe ...
- Zabbix 更改监控项的应用级
- view之Scroller工具类和GestureDetector的简单用法
转载:http://ipjmc.iteye.com/blog/1615828 Android里Scroller类是为了实现View平滑滚动的一个Helper类.通常在自定义的View时使用,在View ...
- typescript静态属性,静态方法,抽象类,多态
/* 1.vscode配置自动编译 1.第一步 tsc --inti 生成tsconfig.json 改 "outDir": "./js", 2.第二步 任务 ...
- 知识点:java 注解 @SuppressWarnings
前言: 简介:java.lang.SuppressWarnings是J2SE5.0中标准的Annotation之一.可以标注在类.字段.方法.参数.构造方法,以及局部变量上.作用:告诉编译器忽略指定的 ...
- UE4如何检测目标在锥形视野内
转自:http://blog.csdn.net/l346242498/article/details/70237083 做UE4游戏AI方面经常会遇到一个问题,就是何如判定目标在AI单位的视野范围内, ...
- (转) C#之VS自带RDLC报表学习
原文地址:http://blog.csdn.net/hk_5788/article/details/49846905 原文工具VS2010,测试版本工具VS2013 报表是这样设计的: 看看结果: ...
- webstorm命令行无法使用node-gyp进行编译
换成cmd命令即可: