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

第一种:通过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:
通过Jquery获取RadioButtonList选中值
 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

---恢复内容结束---

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2021-11-21
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
猜你喜欢
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
相关资源
相似解决方案