jquery 取值 radio 问题
来源:互联网 发布:信越7783硅脂淘宝 编辑:程序博客网 时间:2024/05/16 23:33
1.获取选中值,三种方法都可以:
$('input:radio:checked').val();
$("input[type='radio']:checked").val();
$("input[name='rd']:checked").val();
2.设置第一个Radio为选中值:
$('input:radio:first').attr('checked', 'checked');
或者
$('input:radio:first').attr('checked', 'true');
注:attr("checked",'checked')= attr("checked", 'true')= attr("checked", true)
3.设置最后一个Radio为选中值:
$('input:radio:last').attr('checked', 'checked');
或者
$('input:radio:last').attr('checked', 'true');
4.根据索引值设置任意一个radio为选中值:
$('input:radio').eq(索引值).attr('checked', 'true');索引值=0,1,2....
或者
$('input:radio').slice(1,2).attr('checked', 'true');
5.根据Value值设置Radio为选中值
$("input:radio[value=http://www.2cto.com/kf/201110/'rd2']").attr('checked','true');
或者
$("input[value=http://www.2cto.com/kf/201110/'rd2']").attr('checked','true');
$('input:radio:checked').val();
$("input[type='radio']:checked").val();
$("input[name='rd']:checked").val();
2.设置第一个Radio为选中值:
$('input:radio:first').attr('checked', 'checked');
或者
$('input:radio:first').attr('checked', 'true');
注:attr("checked",'checked')= attr("checked", 'true')= attr("checked", true)
3.设置最后一个Radio为选中值:
$('input:radio:last').attr('checked', 'checked');
或者
$('input:radio:last').attr('checked', 'true');
4.根据索引值设置任意一个radio为选中值:
$('input:radio').eq(索引值).attr('checked', 'true');索引值=0,1,2....
或者
$('input:radio').slice(1,2).attr('checked', 'true');
5.根据Value值设置Radio为选中值
$("input:radio[value=http://www.2cto.com/kf/201110/'rd2']").attr('checked','true');
或者
$("input[value=http://www.2cto.com/kf/201110/'rd2']").attr('checked','true');
0 0
- jquery 取值 radio 问题
- jquery radio取值,checkbox取值
- jquery radio取值,checkbox取值,select取值
- jQuery学习笔记--jquery radio取值,checkbox取值,select取值,radio选中,checkbox
- JQuery radio,select选中与取值
- jQuery radio的取值与赋值
- jquery取当前选中的radio值
- jquery radio取值,checkbox…
- jquery radio 取值 取消选中 赋值
- Jquery取值简介(radio,select,checkbox)
- jQuery radio的取值与赋值
- jQuery radio的取值与赋值
- jquery radio取值,checkbox取值,select取值,radio选中值
- jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中
- jquery radio取值,checkbox取值,select取值,radio选中
- jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中
- jquery radio取值,checkbox取值,select取值,radio选中
- jquery radio取值,checkbox取值,select取值,radio选中
- iptables脚本
- ClamAV源码配置安装测试
- Ambiguous column name
- 一看就懂的ReactJs入门教程(精华版)
- kafka实践
- jquery 取值 radio 问题
- #1064-You hava an error in your SQL syntax
- codeforces #345 div.2 B Beautiful Paintings
- 【leetcode】【169】Majority Element
- CK-----------------ocx端口打开失败
- 47. Permutations II
- 回车和换行
- windows远程连接Ubuntu14.04—vnc4server
- JAVA CAS实现原理与使用