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

 

posted @ 2013-01-11 14:48  程序猿网友666  阅读(227)  评论(0编辑  收藏  举报