联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

jquery遍历checkbox介绍 - Web前端

作者:98wpeu发布时间:2026-06-19分类:网页前端技术浏览:2


导读:checkbox全选\全部取消$("#ChkAll").click(function(){   $("#divContentinput[type='Checkbox']")....

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)

标签:遍历Webcheckboxjquery


网页前端技术排行
最近发表
网站分类
标签列表