$("#1").find("Radio1").prop('checked', true);
$("#2").find("Radio1").prop('checked', true);

<div id="1" cvalue='false'>
Are you a student ?
<br> <input type="radio" name="RadioB1" id="Radio1" value="1">
<label for="Radio1">Yes</label><br>
<input type="radio" name="RadioB1" id="Radio2" value="2">
<label for="Radio2">No</label>
</div>
<br/>
<div id="2" cvalue='false' >
Do you study in a university ?
<br>
<input type="radio" name="RadioB1" id="Radio3" class="ui-state-default ui-corner-all" value="1">
<label for="Radio1">Yes</label><br>
<input type="radio" name="RadioB1" id="Radio4" class="ui-state-default ui-corner-all" value="2">
<label for="Radio2">No</label>
</div>
&#13;
答案 0 :(得分:0)
我想知道您为什么要使用javascript
来执行此操作?你可以像这样使用纯html
:
<div id="1" cvalue='false'>
Are you a student ?
<br> <input type="radio" name="RadioB2" id="Radio1" value="1" checked="checked">
<label for="Radio1">Yes</label><br>
<input type="radio" name="RadioB2" id="Radio2" value="2">
<label for="Radio2">No</label>
</div>
<br/>
<div id="2" cvalue='false' >
Do you study in a university ?
<br>
<input type="radio" name="RadioB1" id="Radio3" class="ui-state-default ui-corner-all" value="1" checked="checked">
<label for="Radio1">Yes</label><br>
<input type="radio" name="RadioB1" id="Radio4" class="ui-state-default ui-corner-all" value="2">
<label for="Radio2">No</label>
</div>
注意: 您只需使用checked="checked"
并使用不同的name
为每个问题选择多个。