ラジオ(質問へのオプション)を備えたフィールドセットがあります。ページショーでオプションコントロールグループのラジオボタンをプログラムで事前に選択したいのですが、コントロールグループは次のとおりです。
<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");