我想限制取消所有3个复选框的能力。jquery禁用剩余的复选框时,2 3未经检查
<input type="checkbox" value="one" checked> one
<input type="checkbox" value="two" checked> two
<input type="checkbox" value="three" checked> three
$(":checkbox").click(function() {
if ($("input:checked").length == 2){
$(':checkbox(:checked)').prop('disabled', false);
}else{
$(':checkbox(:checked)').prop('disabled', true);
}
});
我不能得到它来禁用最后一个复选框,因为没有被选中。 请帮忙!
为什么downvote? – BragDeal
我没有downvote,但你的小提琴工作 – AmmarCSE
不,它禁用其他两个再次检查!我应该只允许我取消选中3中的2个,但我应该始终能够检查未选中的项目 – BragDeal