How to get the selected value from asp radio button list?

     Usually some one checking all the radio button(checked or not) one by one and get the selected radio button value. But we can get the radio button value in a single line using jquery.

Example
asp Radio button

   <asp:RadioButtonList ID="Rbtn_ModeSetBy" runat="server">
        <asp:ListItem Value="0">All Employees</asp:ListItem>
        <asp:ListItem Value="1">Grade</asp:ListItem>
        <asp:ListItem Value="2">Job Title</asp:ListItem>
        <asp:ListItem Value="3">Employment Status</asp:ListItem>
   </asp:RadioButtonList>

jQuery Code

   var val =$('[id*="<%=Rbtn_ModeSetBy.ClientID%>"]').find('input:checked').val();

0 nhận xét:

Đăng nhận xét