给定以下html:
<dt><span class="q-num">1</span>. What is one plus one?</dt>
<dd><input type="radio" value="a" name="1" required /> 4</dd>
<dd><input type="radio" value="b" name="1" required /> 7</dd>
<dd><input type="radio" value="c" name="1" required /> 2</dd>
<dd><input type="radio" value="d" name="1" required /> 8</dd>
<dt><span class="q-num">2</span>. What is two plus two?</dt>
<dd><input type="radio" value="a" name="2" required /> 4</dd>
<dd><input type="radio" value="b" name="2" required /> 7</dd>
<dd><input type="radio" value="c" name="2" required /> 2</dd>
<dd><input type="radio" value="d" name="2" required /> 8</dd>
<dt><span class="q-num">3</span>. What is three plus three?</dt>
<dd><input type="radio" value="a" name="3" required /> 4</dd>
<dd><input type="radio" value="b" name="3" required /> 7</dd>
<dd><input type="radio" value="c" name="3" required /> 2</dd>
<dd><input type="radio" value="d" name="3" required /> 6</dd>
单击任何时,我想要alert()
最近的前一个值。我试过了,但我得到的只是一个空白警报..span[class='q-num']
input[type='radio']
closest()