推荐 使用第二种,第一种有时候不起作用

第一种:通过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选中值的更多相关文章

  1. jquery获取radio选中值及遍历

    使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项:1.& ...

  2. JQuery获取select选中值和清除选中状态(转)

    1.获取值 var provinceSearch = $("#loc_province_search").find("option:selected").att ...

  3. Jquery获取selelct选中值

    误区: 一直以为jquery获取select中option被选中的文本值,是这样写的: $("#s").text();  //获取所有option的文本值 实际上应该这样: $(& ...

  4. Jquery 获取 radio选中值,select选中值

    随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox.Radiobutton .DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的操作 ...

  5. 纠正jQuery获取radio选中值的写法

    先看一段代码 <input type="radio" name="aaa" value="1" checked="true& ...

  6. Jquery 获取radio选中值

  7. jquery 获取checkbox 选中值并拼接字符集

    1.代码示例: var chk_value =[]; $('input[name="rewardids"]:checked').each(function(){   chk_val ...

  8. JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. jquery动态选中radio,获取radio选中值

    //动态选中radio值,1:表示radio的name 2:表示后台传过来的radio值$(":radio[name='1'][value='" + 2 + "']&qu ...

随机推荐

  1. POJ3274-Gold Balanced Lineup

    题目链接:点击打开链接 Gold Balanced Lineup Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16978 ...

  2. (反NIM)

    题目大意是和普通的NIM游戏一样,但是却是取到最后一个是输的,天真的以为就是反过来,其实并不是这样的 结论 先手必胜的条件为 ①:所有堆的石子数均=1,且有偶数堆. ②:至少有一个堆的石子数>1 ...

  3. spring不同环境下用不同的配置文件

    @Configuration @PropertySource("xx-${spring.profiles.active}.properties") public class Top ...

  4. mysql 主从复制以及binlog 测试

    ###mysql查看binlog日志内容 https://blog.csdn.net/nuli888/article/details/52106910 mysql的binlog日志位置可通过show ...

  5. AD按键-矩阵按键-独立按键:

    原理:利用数组分压+AD采集: 优点:一个IO口可以做成多个按键,节省IO口(矩阵键盘在>4时优点才能体现出来):可备用作为AD基准输入. 缺点:不能做成组合按键(或者电阻要精确选择):且离IO ...

  6. Washing Plates 贪心

    https://www.hackerrank.com/contests/101hack41/challenges/washing-plates 给定n个物品,选这个物品,贡献 + p, 不选的话,贡献 ...

  7. ArrayList相关方法介绍及源码分析

    目录 ArrayList简介: ArrayList 相关方法介绍 代码表示 相关方法源码分析 ArrayList简介: java.util.ArrayList 是我们最常用的一个类,ArrayList ...

  8. strstr strcpy 函数的实现

    一. strcpy 代码实现 #include <iostream> #include <assert.h> #include <iostream> //#incl ...

  9. 配置百度云盘python客户端bypy上传备份文件

    要求:安装python2.7,安装git 1.git clone https://github.com/houtianze/bypy.git 2.cd bypy 3.sudo python setup ...

  10. httpclient通过post提交到webapi

    var client = new HttpClient(); var url = BASConfig.Instance.SiteSettingsModule.SyncWorkLogAppUrl; va ...