<script src="JS/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(function () {
$('[value=全选]').click(function () {
$(':checkbox').attr("checked", "checked");
});
$('[value=全不选]').click(function () {
$(':checkbox').removeAttr("checked");
});
$('[value=反选]').click(function () {
////1.
//$(':checkbox').each(function () {
// $(this).attr("checked", !$(this).attr("checked"));
//});
//2.
// $(':checkbox').each(function () {
$(':checkbox').attr("checked", function () {
if ($(this).attr("checked"))
return false;
return true;
});
// });
});
});
</script>
</head>
<body>
<input type="button" value="全选" />
<input type="button" value="反选" />
<input type="button" value="全不选" /><br />
<input type="checkbox" id="1" /><label for="1">1</label>
<input type="checkbox" id="2" /><label for="2">2</label>
<input type="checkbox" id="3" /><label for="3">3</label>
<input type="checkbox" id="4" /><label for="4">4</label>
<input type="checkbox" id="5" /><label for="5">5</label>
<input type="checkbox" id="6" /><label for="6">6</label>
<input type="checkbox" id="7" /><label for="7">7</label>
<input type="checkbox" id="8" /><label for="8">8</label>
<input type="checkbox" id="9" /><label for="9">9</label> </body

JQuery下CheckBox全选全不选反选的更多相关文章

  1. jquery操作checkbox方法(全选、全不选、至少选择一个、选择值/文本)

    原文:http://blog.csdn.net/u014079773/article/details/52371382 在实际开发中我们经常操作checkbox,不仅仅要获得checkbox选中的值, ...

  2. jquery实现checkbox列表的全选不选

    html代码 <th><input type="checkbox" onclick="selectAll(this);" />全选/取消 ...

  3. 【jQuery】CheckBox使用attr全选无法正确显示

    今天编写JS脚本时,遇到如下的问题. 下面是源代码: <script src="../Scripts/jquery-2.1.3.js"></script> ...

  4. jquery中checkbox全选失效的解决方法

    这篇文章主要介绍了jquery中checkbox全选失效的解决方法,需要的朋友可以参考下     如果你使用jQuery 1.6 ,代码if ( $(elem).attr(“checked”) ),将 ...

  5. Jquery 遍历 Table;遍历CheckBox ;遍历Select;全选/全不选

    关于Jquery:相信大家已经很熟悉了,我最近的项目运用到关于Jquery的遍历事件:权当总结下: 遍历Table <table  id="thistab"> < ...

  6. 解决jquery操作checkbox全选全不选无法勾选问题

    最近在学习中使用jquery操作checkbox,使用下面方法进行全选.反选:$("input[name='checkbox']").attr("checked" ...

  7. jquery实现checkbox全选和全部取消,以及获取值

    在后台管理中经常会遇到列表全选和取消的功能,如评论审核.申请等,用到的html标记就是checkbox.我用的是mysql数据库,代码如下: <!DOCTYPE html PUBLIC &quo ...

  8. jquery实现checkbox的全选

    <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> < ...

  9. jQuery实现Checkbox中项目开发全选全不选的使用

    <html> <head> <meta charset="utf-8"> <title>Checkbox的练习</title& ...

随机推荐

  1. trunc sysdate

    select *  from per_all_people_f papf where trunc(sysdate) between trunc(papf.effective_start_date) a ...

  2. 蓝牙Host Controller Interface笔记

    1.概述     HCI提供了一个统一的使用蓝牙控制器(BR/EDR Controller,BR/EDR/LE Controller,LE Controller,AMP Controller等)的方法 ...

  3. BLE-NRF51822教程18-overview

    转自:http://blog.csdn.NET/xgbing 蓝牙协议栈 nrf51822开发中,蓝牙协议栈和应用开发是分开的. (1)兼容蓝牙4.0低功耗协议栈基带层,L2CAP\AAT\SM\GA ...

  4. 玩儿了一下django User authentication

    五一在家,VPN不能链接了,而项目在本地run的过程中,又需要链接公司的SSO server才能login.下雨,不想去公司,又不得不在家做task,只能想办法避开SSO login,以前知道djan ...

  5. Naming Conventions for .NET / C# Projects

    http://www.akadia.com/services/naming_conventions.html Naming Conventions for .NET / C# Projects Mar ...

  6. Selenium2学习-020-WebUI自动化实战实例-018-获取浏览器窗口位置大小

    在 UI 自动化测试过程中,每个机器上浏览器的默认大小.默认位置不尽相同,需要截图的时候,页面元素可能显示不完全,因而我们需要知道浏览器的宽度,或者直接在启动浏览器时,设置浏览器的宽度或位置(此文暂不 ...

  7. flex布局中flex-basis|flex-grow|flex-shrink

    flex布局中flex-basis|flex-grow|flex-shrink 整个才是正确的算法 flex-basis(基准值) 可以设置flex布局中容器的宽度,如果同时存在width属性,将把它 ...

  8. MySQL注释符

    mysql注释符有三种:1.#...(注释至行末,推荐)2.-- ...(两条短线之后又一个空格)3./*...*/(多行注释) 1.

  9. http://blog.csdn.net/yaerfeng/article/details/27683813

    http://blog.csdn.net/yaerfeng/article/details/27683813

  10. LeetCode Expression Add Operators

    原题链接在这里:https://leetcode.com/problems/expression-add-operators/ 题目: Given a string that contains onl ...