选择一个单选按钮我有带收音机的字段(选择一个问题),我想预选编程页上显示的选项控制组中的单选按钮,这里是对照组:在一个字段通过编程
<fieldset data-role="controlgroup" id="options">
<input type="radio" name="radio-choice-1" id="optiona" value="a"
checked="checked" />
<label for="optiona" id="labela">Ondo</label>
<input type="radio" name="radio-choice-1" id="optionb" value="b" />
<label for="optionb">Lagos</label>
<input type="radio" name="radio-choice-1" id="optionc" value="c" />
<label for="optionc">Abuja</label>
<input type="radio" name="radio-choice-1" id="optiond" value="d" />
<label for="optiond">Kogi</label>
<input type="radio" name="radio-choice-1" id="optione" value="e" />
<label for="optione">Niger</label>
</fieldset>
我曾尝试以下:
var sel = questions[indexNo].correct;
$("#option" + sel).prop("checked", true)
$("#option"+ sel).is(":checked");
问题对象的外观如何? –
问题是一个看起来像这个问题的数组对象({'quest':'“,'optiona':”“,'optionsb':”“,'correct':”“}),我不认为这是重要的cos我试图做的是跟踪每个问题的用户选择的答案,当用户再次导航到问题时,他的选择将被预先选中 – kolexinfos