2015年11月6日 16:32:49
选中第四个的时候提示超过了3个, 点解alert框取消后, 将最后一个选中的checkbox取消选中
<script>
$(document).ready(function (){
$('input[type=checkbox]').click(function(){
if ($("input[name='contract[]']:checked").length > 3) {
alert('最多选3个');
$(this).removeAttr("checked");
}
});
});
</script>