- 时间:2020-12-02 13:14 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:jquery遍历checkbox介绍
[b]checkbox 全选\全部取消
[/b]$("#ChkAll").click(function(){
$("#divContent input[type='checkbox']").attr("checked",$(this).attr("checked"));
});
[b]获取选中的checkbox的value值:
[/b]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)