私はこのリンクをチェックしましたIDに基づいてjqueryでラジオボタンを「チェック済み」に設定しますしかし、私にはあまり適していないようです。これは私のコードです
<label for="basic" class="basic">Gender:</label>
<fieldset data-type="horizontal" data-role="controlgroup" data-mini="true">
<input type="radio" name="gender" id="radio-mini-1" value="Male" checked="checked" />
<label for="radio-mini-1">Male</label>
<input type="radio" name="gender" id="radio-mini-3" value="Female" />
<label for="radio-mini-3">Female</label>
</fieldset>
と
<label for="select-choice-min" class="select">Living Place:</label>
<select name="select-choice-min" id="livingPlace" data-mini="true">
<optgroup label="AAA">
<option value="123">123</option>
<option value="456">456</option>
</optgroup>
<optgroup label="BBB">
<option value="789">789</option>
<option value="246">246</option>
</optgroup>
</select>
次のコードを使用してデフォルト値を設定できますか? 動作しないようです
$("#livingPlace :selected").text(data[0].data.livingPlace);
//$('#livingPlace option[value=data[0].data.livingPlace]').attr("selected",true);
$("input[name=gender]:checked").val(data[0].data.gender);