zoukankan      html  css  js  c++  java
  • 使用jquery 获取RadioButtonList 中选中值

    方法1:摘自网络

    View Code
    <mce:script language="javascript"><!--
            $(document).ready(function() {
    
                $("#btnSubmit").click(function() {
    
                    alert($("#RadioButtonList1").find("input[@checked]").val());
    
                });
    
            });
    
        
    // --></mce:script>
    
     
    
    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
    
            <asp:ListItem>1</asp:ListItem>
    
            <asp:ListItem>2</asp:ListItem>
    
            <asp:ListItem>3</asp:ListItem>
    
        </asp:RadioButtonList>
    
         <input id="btnSubmit" type="button" value="Submit" />

    方法2:原创

    View Code
    var rubricType = $("input[name='rblRubricType']:checked").val();
    
    <mce:script language="javascript"><!--
            $(document).ready(function() {
                $("#btnSubmit").click(function() {
                    alert($("input[name='RadioButtonList1']:checked").val());
                });
            });
    // --></mce:script>
    
    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
            <asp:ListItem>1</asp:ListItem>
            <asp:ListItem>2</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
    </asp:RadioButtonList>
    
    <input id="btnSubmit" type="button" value="Submit" />
  • 相关阅读:
    Ch04-文字列表的设计
    ch03-文字版面的设计
    ch02-HTML的基本概念
    【转】网站建设常用工具
    XSY1036 [Apio2012]派遣
    HDU1512 Monkey King
    快速构造FFT/NTT
    支配树学习笔记
    BZOJ1026[SCOI2009]windy数
    扩展欧几里得算法(exGCD)学习笔记
  • 原文地址:https://www.cnblogs.com/chenghu/p/2856428.html
Copyright © 2011-2022 走看看