使用jquery 获取RadioButtonList 中选中值

来源:互联网 发布:软件版本express 编辑:程序博客网 时间:2024/05/16 22:18

第一种方法:

<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" />

第二种方法:

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" />

 

0 0
原创粉丝点击