您的位置:首页 > Web前端 > JQuery

jquery 设置checkbox全选 全不选

2014-04-22 17:03 225 查看
<input id="all" type='checkbox'  />

 <input type='checkbox' value='1’ name="mailId"/>

 <input type='checkbox' value='2‘ name="mailId"/>

<input type='checkbox' value='3‘ name="mailId"/>

js中

$(document).ready(function(){

    //全选、全不选

    $("#all").click(function(){

        if(this.checked){

            $("input[name='mailId']").prop("checked", true);  

        }else{

            $("input[name='mailId']").prop("checked", false);  

        }

        

    });

})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: