radio 按钮组, name=”sex”.
<input type="radio" name="sex" value="Male">Male</input>
<input type="radio" name="sex" value="Female">Female</input>
<input type="radio" name="sex" value="Unknown">Unknown</input>
1. 获取radio选中的value.
$('input:radio[name=sex]:checked').val();
2. 选择 radio 按钮 (Male).
$('input:radio[name=sex]:nth(0)').attr('checked',true);
或者
$('input:radio[name=sex]')[0].checked = true;
3. 选择 radio 按钮 (Female).
$('input:radio[name=sex]:nth(1)').attr('checked',true);
或者
$('input:radio[name=sex]')[1].checked = true;
4. 选择 radio 按钮 (Unknown).
$('input:radio[name=sex]:nth(2)').attr('checked',true);
或者
$('input:radio[name=sex]')[2].checked = true;
5. 重置 radio 按钮.
$('input:radio[name=sex]').attr('checked',false);