I have a set of fields with radio (question options), I want to pre-select the switch in the parameter management group programmatically on the show page, here is the control group:
<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>
I tried the following:
var sel = questions[indexNo].correct; $("#option" + sel).prop("checked", true) $("#option"+ sel).is(":checked");
source share