通过Jquery获取RadioButtonList选中值
推荐 使用第二种,第一种有时候不起作用
第一种:通过find方法 获取RadioButtonList所选中的值
<script type="text/javascript">
$(document).ready(function () {
//保存之前去验证所有字段是否符合
$("#btn_save").click(function () {
$("#rbl_sex").find("[checked]").val();
})
})
</script>
第二种:
<script type="text/javascript">
$(document).ready(function () {
$("#btn_save").click(function () {
$("input[name='rbl_sex']:checked").val();
})
})
</script>
HTML:
<div class="line">
<div class="left">
性别
</div>
<div class="mid">
<asp:RadioButtonList ID="rbl_sex" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="男"></asp:ListItem>
<asp:ListItem Text="女"></asp:ListItem>
</asp:RadioButtonList>
</div>
<div class="right">
</div>
</div>
<asp:Button ID="btn_save" runat="server" Text="提交" />

1 <div class="line">
2 <div class="left">
3 性别
4 </div>
5 <div class="mid">
6 <asp:RadioButtonList ID="rbl_sex" runat="server" RepeatDirection="Horizontal">
7 <asp:ListItem Text="男"></asp:ListItem>
8 <asp:ListItem Text="女"></asp:ListItem>
9 </asp:RadioButtonList>
10 </div>
11 <div class="right">
12 </div>
13 </div>
14 <asp:Button ID="btn_save" runat="server" Text="提交" />
http://www.cnblogs.com/mystar/archive/2013/04/18/3028165.html
---恢复内容结束---
通过Jquery获取RadioButtonList选中值的更多相关文章
- jquery获取radio选中值及遍历
使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项:1.& ...
- JQuery获取select选中值和清除选中状态(转)
1.获取值 var provinceSearch = $("#loc_province_search").find("option:selected").att ...
- Jquery获取selelct选中值
误区: 一直以为jquery获取select中option被选中的文本值,是这样写的: $("#s").text(); //获取所有option的文本值 实际上应该这样: $(& ...
- Jquery 获取 radio选中值,select选中值
随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox.Radiobutton .DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的操作 ...
- 纠正jQuery获取radio选中值的写法
先看一段代码 <input type="radio" name="aaa" value="1" checked="true& ...
- Jquery 获取radio选中值
- jquery 获取checkbox 选中值并拼接字符集
1.代码示例: var chk_value =[]; $('input[name="rewardids"]:checked').each(function(){ chk_val ...
- JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery动态选中radio,获取radio选中值
//动态选中radio值,1:表示radio的name 2:表示后台传过来的radio值$(":radio[name='1'][value='" + 2 + "']&qu ...
随机推荐
- Git练习2 使用码云
- git教程1-gitlab部署
https://about.gitlab.com/install/#centos-7 https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/ gitla ...
- jmeter将参数值写入到指定文件(转)
有时在测试过程中需要将测试过程中生成的参数保存下来,jmeter并没有此类功能,此时,可以 通过beanshell编写代码来实现 思路: 每次请求响应返回后,通过正则表达式获取到需要保存的值,通过Be ...
- JOS环境搭建
想写一个OS很久了,今天开始正式动工了!! 大家都知道操作系统是计算机科学中十分重要的一门基础学科.但是以前在学习这门课时,仅仅只是把目光停留在课本上一些关于操作系统概念上的叙述,并不能对操作系统有着 ...
- ACM-ICPC 2018 沈阳赛区网络预赛 D. Made In Heaven(约束第K短路)
题意:求11到nn的第kk短的路径长度,如果超过TT输出Whitesnake!Whitesnake!,否则输出yareyaredawayareyaredawa. 好无以为 , 这就是一道模板题, 当是 ...
- myeclipse-9.0安装svn客户端插件
SVN插件配置到MyEclipse中的步骤 听语音 | 浏览:20471 | 更新:2015-01-09 10:26 | 标签:myeclipse 1 2 3 4 5 6 7 分步阅读 MyEclip ...
- aspnetcore配置log4net并添加全局异常处理
第一步:在NuGet中引用log4net 第二步:创建log4net.config <?xml version="1.0" encoding="utf-8" ...
- 03.Spring IoC 容器 - 初始化
基本概念 Spring IoC 容器的初始化过程在监听器 ContextLoaderListener 类中定义. 具体由该类的的 configureAndRefreshWebApplicationCo ...
- pat1079. Total Sales of Supply Chain (25)
1079. Total Sales of Supply Chain (25) 时间限制 250 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE ...
- Day2下午
虽然成绩不太好,但有点进入状态了.期望200 实际160,忘记加判断了. T1 洗澡[问题描述]你是能看到第一题的friends 呢.——hja洗澡的地方,有一段括号序列,将一个括号修改一次需要1的代 ...