码迷,mamicode.com
首页 > Web开发 > 详细

Jquery checkbox 遍历

时间:2017-07-27 23:28:38      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:attr   com   cli   on()   func   name   key   value   str   

checkbox 全选\全部取消

$("#ChkAll").click(function(){
    $("#divContent input[type=‘checkbox‘]").attr("checked",$(this).attr("checked"));
});

 

获取选中的checkbox的value值:

var arrChk=$("input[name=‘chk_list‘][checked]");
    $(arrChk).each(function(){
       window.alert(this.value);                        
    }); 
});

 

$("#checkbox_id").attr("checked"); //获取一个CheckBox的状态(有没有被选中,返回true/false) 

$("#checkbox_id").attr("checked",true); //设置一个CheckBox的状态为选中(checked=true) 

Jquery checkbox 遍历

标签:attr   com   cli   on()   func   name   key   value   str   

原文地址:http://www.cnblogs.com/thinkingthigh/p/7247757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!