js代码:
function fff(){
$('#<%=rbl.ClientID%> input').each(function (){
if(this.checked){
alert("value的值是" + this.value);
}
})
}
$(’#<%=rbl.ClientID%>’) 这个获取生成html后的RadioButtonList,后面加个input是因为asp:ListItem在html中会变为input。
aspx代码:
<asp:RadioButtonList ID="rbl" runat="server">
<asp:ListItem Value="1" Text="男"></asp:ListItem>
<asp:ListItem Value="2" Text="女"></asp:ListItem>
</asp:RadioButtonList>