jquey checkbox全选,反选

jquey全选下拉框

序号 姓名 手机号码 电话号码 电子邮件 分组
+8613905740066 +8613905740066     同学
692403       客户
大娘水饺       朋友
郑麻将       客户
郑敏       客户
郑银行       客户
中山饭店       客户
钟媒气       客户
钟益明       客户
周常春       客户
01 $.fn.checkbox = function(){
02 var hand = this;
03 /**
04 * 切换全选/反选
05 *
06 * @example $("#checkAll").checkbox().toggle($("input[name='contactIds']"));
07 */
08 this.toggle = function(ele){
09 $(ele).click(function(){
10 $(hand).attr('checked', false);
11 });
12 $(this).click(function(){
13 $(ele).attr('checked', $(this).attr('checked') == true ? true : false);
14 });
15 };
16 /**
17 * 全选
18 */
19 this.checked = function(ele){
20 $(ele).attr('checked', true);
21 };
22 /**
23 * 反选
24 */
25 this.unchecked = function(ele){
26 $(ele).attr('checked', false);
27 };
28 return this;
29 };

转自http://www.popo4j.com/article/jquey-checkbox-select-all.html

posted on 2011-01-14 20:08  senly  阅读(422)  评论(0编辑  收藏  举报

导航