<
>

Jquery 实现checkbox全选方法

2019-07-15 11:03:28 来源:易采站长站 作者:王冬梅


});

页面使用


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js" type="text/javascript">
    </script>
    <script src="xs_checkbox_all.js" type="text/javascript"></script>
    <fieldset>
        <legend>全选one</legend>
        <input type="checkbox" class="xsChk" name="chk" />
        全选
    <div>
        <input type="checkbox" name="chk" />
        1<br />
        <input type="checkbox" name="chk" />
        2<br />
        <input type="checkbox" name="chk" />
        3<br />
        <input type="checkbox" name="chk" />
        4<br />
    </div>
    </fieldset>
    <fieldset>
        <legend>全选two</legend>
        <input type="checkbox" class="xsChk" name="chk1" />
        全选2
    <div>
        <input type="checkbox" name="chk1" />
        11<br />
        <input type="checkbox" name="chk1" />
        22<br />
        <input type="checkbox" name="chk1" />
        33<br />
        <input type="checkbox" name="chk1" />
        44<br />
    </div>
    </fieldset>
</body>
</html>

可以达到效果,如果有什么优化的地方,请大家提出,我会做的更好,谢谢大家了,以上就是本文的全部内容了,希望大家能够喜欢。

暂时禁止评论

微信扫一扫

易采站长站微信账号