首页 > 技术文章 > checkbox多选按钮变成单选

chaihy 2017-05-22 09:39 原文

<input id="a" type="checkbox"/>
<input id="b" type="checkbox"/>
<script>
$('#a').click(function(){
$(this).attr('checked','checked');
$('#b').removeAttr('checked');
})
$('#b').click(function(){
$(this).attr('checked','checked');
$('#a').removeAttr('checked');
})
</script>

推荐阅读