Getting selected value from RadioButtonList using JavaScript.

Posted by Vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 921
Below code snippet will help us how to get selected values from RadioButtonList using JavaScript in a simple way:-

<script language = "javascript" type = "text/javascript">
function Get_RadiobuttonList_SelectedValue()
var list = document.getElementById("<%= rdbtnLst.ClientID %>"); //Cleint ID of RadioButtonList
var rdbtnLstValues = list.getElementsByTagName("input");
var Checkdvalue;
for (var i = 0; i < rdbtnLstValues.length; i++)
if (rdbtnLstValues[i].checked)
Checkdvalue = rdbtnLstValues[i];
if (Checkdvalue)
<asp:RadioButtonList ID="rdbtnLst" AutoPostBack="true" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Selected="True">One</asp:ListItem>
<asp:Button ID="Button1" runat="server" OnClientClick="GetSelectedValue()" Text="Button" />

Comments or Responses

Login to post response