jquery radio的取值_radio的选中_radio的重置方法
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);
相关推荐
zhanghaibing00 2020-06-28
lbPro0 2019-11-03
donghongbz 2019-10-19
89367741 2016-03-30
SinhaengHhjian 2016-01-25
89453862 2015-10-10
aaalk00 2015-03-31
xiuping0 2014-08-11
ruoyiqing 2014-03-18
mapdigit 2013-12-10
pplxh 2013-12-03
limengmeng00 2013-09-27
健康学习 2013-07-29
Allenyhy 2013-06-13
82483564 2013-04-28
88463368 2013-04-24
MaureenChen 2020-05-25