# 复选框模拟单选按钮功能

<script type="text/javascript">
    $(function() {
        $('input[name=checkbox]').click(function() {
            $(this).attr('checked', 'checked').siblings().removeAttr('checked');
        });
    })
</script>

<body>
    <input type="checkbox" name="checkbox" id="checkbox1"/>
    <input type="checkbox" name="checkbox" id="checkbox2" checked="checked"/>
    <input type="checkbox" name="checkbox" id="checkbox3" />
</body>
1
2
3
4
5
6
7
8
9
10
11
12
13
更新时间: 2021-06-30 22:17:08