我正在尝试提取具有特定类名的收音机的“data-val”。
我需要它:在具有“正确”类的无线电组中查找元素的数据值
我不能为我的生活想到如何做到这一点。有什么想法吗?
HTML
<fieldset>
<input type='radio' name='rads1' id='x1' data-val='23' class='correct'/>
<label for='x1'>#1</label><br/>
<input type='radio' name='rads1' id='x2' data-val='46' class='incorrect'/>
<label for='x2'>#2</label><br/>
<input type='radio' name='rads1' id='x3' data-val='16' class='incorrect'/>
<label for='x3'>#3</label><br/>
<input type='radio' name='rads1' id='x4' data-val='52' class='incorrect'/>
<label for='x4'>#4</label><br/>
</fieldset><br/>
<fieldset>
<input type='radio' name='rads2' id='y1' data-val='3' class='incorrect'/>
<label for='y1'>#1</label><br/>
<input type='radio' name='rads2' id='y2' data-val='6' class='incorrect'/>
<label for='y2'>#2</label><br/>
<input type='radio' name='rads2' id='y3' data-val='36' class='correct'/>
<label for='y3'>#3</label><br/>
<input type='radio' name='rads2' id='y4' data-val='12' class='incorrect'/>
<label for='y4'>#4</label><br/>
</fieldset>