checkbox 全选、全不选、反选 插件
jquery.checkbox.js:
;(function($,window,document,undefined){
$.fn.check=function(mode){
mode= mode || "on";
return this.each(function(){
switch(mode){
case "on":
this.checked=true;
break;
case "off":
this.checked=false;
break;
case "toggle":
this.checked=!this.checked;
break;
}
});
};
})(jQuery,window,document);
使用方法:
$('input:checkbox').check('toggle');
几个要点:
1、匿名函数自调用执行,避免变量污染。
2、传递系统变量,避免系统变量冲突。
3、在插件里加上return,支持链式调用。
4、匿名函数前加分号,避免前面代码结尾处忘记加分号,导致自己的代码解析失败。
checkbox 全选、全不选、反选 插件的更多相关文章
- jQuery全选反选插件
(function($){ $.fn.check = function(options){ var options = $.extend({ element : "input[name='n ...
- 利用jQuery实现CheckBox全选/全不选/反选
转自:http://www.cnblogs.com/linjiqin/p/3148259.html jQuery有些版本中实现CheckBox全选/全不选/反选会有bug,经测试jquery-1.3. ...
- Android 带checkbox的listView 实现多选,全选,反选
由于listview的一些特性,刚开始写这种需求的功能的时候都会碰到一些问题,重点就是存储每个checkbox的状态值,在这里分享出了完美解决方法: 布局文件: [html] <?x ...
- 【转】Android 带checkbox的listView 实现多选,全选,反选 -- 不错
原文网址:http://blog.csdn.net/onlyonecoder/article/details/8687811 Demo地址(0分资源):http://download.csdn.net ...
- 【转】Android 带checkbox的listView 实现多选,全选,反选----解决checkbox错位问题
原文网址:http://blog.csdn.net/onlyonecoder/article/details/8687811 Demo地址(0分资源):http://download.csdn.net ...
- Jquery 利用单个复选款(checkbox)实现全选、反选
1 <script type="text/javascript"> $(function(){ //全选 $("#CheckedAll").clic ...
- 全选,不选,反选 jquery
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery 全选 全不选 反选
1.概述 在项目中经常遇到列表中对复选框进行勾选操作,全选...反选.. 2. example <html> <body> <form id="test-for ...
- jquery的全选/全不选/反选以及attr添加checked属性失败的解决办法
如下图: <head> <title></title> <style type="text/css"> div { border: ...
- Jq 遍历 全选 全不选 反选
//全选 全不选 $('#checkAll').click(function () { //判断是否被选中 var bischecked = $('#checkAll').is(':checked') ...
随机推荐
- Virtualbox中安装Openwrt
Virtualbox:https://www.virtualbox.org/wiki/DownloadsOpenwrt:http://downloads.openwrt.org/backfire/10 ...
- iOS的动画效果类型及实现方法
实现iOS漂亮的动画效果主要有两种方法, 一种是UIView层面的, 一种是使用CATransition进行更低层次的控制, 第一种是UIView,UIView方式可能在低层也是使用CATransit ...
- MVC初学 - The type or namespace name 'DbContext' could not be found
问题: The type or namespace name 'DbContext' could not be found (are you missing a using directive or ...
- hihocoder #1301 : 筑地市场 数位dp+二分
题目链接: http://hihocoder.com/problemset/problem/1301?sid=804672 题解: 二分答案,每次判断用数位dp做. #include<iostr ...
- ContextLoaderListener作用详解(转)
ContextLoaderListener监听器的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在 ...
- 【锋利的JQuery-学习笔记】遮罩层
效果图: 鼠标移动到上面后---> html: <div id="jnBrandList"> <ul> <li> <a href= ...
- uva 10994
一开始想法太简单 错了好多遍 #include <cstdio> #include <cstdlib> #include <cmath> #include < ...
- 关于JS及应用程序开发的一些体会
代码通常从 一,生命周期 二,业务流程 这几方面来看. JS Client可以和Server端分离. JS端的生命周期. Server端就是 JS能处理的只是HTTP协议.
- running android lint has encountered a problem
最近写学习android编程的的时候,每次保存.java文件的时候,总会跳出如下错误 解决:
- POJ 1363 Rails(栈)
思路:将出车站的顺序存入数组train,由于入车站的顺序是固定的,为1~N,所以用P表示进站的车,初始为1. 接下来举例说明吧: 原来入站顺序: 1 2 3 4 5 读入的出战顺序: 3 4 2 ...