Jquery实现一组复选框单选

完整代码:

<!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>
    <script src="Js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#ckb").find('input:checkbox').bind('click', function () {
                $("#ckb").find('input:checkbox').not(this).attr('checked', false);
            });
        });
    </script>
</head>
<body>
    <div id="ckb">
        复选框1<input type="checkbox" />
        <br />
        复选框2<input type="checkbox" />
        <br />
        复选框3<input type="checkbox" />
        <br />
        复选框4<input type="checkbox" />
        <br />
        复选框5<input type="checkbox" />
    </div>
</body>
</html>

posted @ 2016-02-23 17:07  赛跑的蜗牛  阅读(431)  评论(1编辑  收藏  举报