查找尚未选中的所有广播组

nic*_*ckf 7 javascript jquery

我有一个我正在处理的基本测验/调查类型的应用程序,如果他们没有回答所有问题,我想在提交之前给用户提示.所有问题都是使用单选按钮的多种选择:

<div class="question">
    Q1: What is the second letter of the alphabet?
    <div class="choices">
        <input type="radio" name="question_1" value="1" /> A
        <input type="radio" name="question_1" value="2" /> B
        <input type="radio" name="question_1" value="3" /> C
    </div>
</div>
<div class="question">
    Q2: Which out of these is a berry?
    <div class="choices">
        <input type="radio" name="question_2" value="1" /> Apples
        <input type="radio" name="question_2" value="2" /> Bananas
        <input type="radio" name="question_2" value="3" /> Carrots
    </div>
</div>
<div class="question"> ...etc
Run Code Online (Sandbox Code Playgroud)

你如何找到哪些组没有勾选?或者至少,如果还有哪些没有得到回答?

jQuery没问题,甚至更喜欢.

nic*_*ckf 24

啊,我弄清楚了:

$('div.question:not(:has(:radio:checked))')
Run Code Online (Sandbox Code Playgroud)