get the value from radiobuttonlist through javascript?

ponnitheunreal

New Member
I have a radibutton list .\[code\] <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" RepeatLayout="flow" > <asp:ListItem Selected="True" Text ="Yes" Value="http://stackoverflow.com/questions/12595378/0"></asp:ListItem> <asp:ListItem Text ="No" Value="http://stackoverflow.com/questions/12595378/1"></asp:ListItem> </asp:RadioButtonList>\[/code\]and to get the value from radio list i have a function \[code\] function getvalueofradiolist() { var radiolist = document.getElementById('<%= RadioButtonList1.ClientID %>'); var rblName = radiolist.name; var radio = document.getElementsByName(rblName); for (var x = 0; x < radio.length; x++) { if (radio[x].checked) { alert("Selected item Value " + radio[x].value); } } }\[/code\]But it returns undefined.Did I write something wrong?I am calling this function from a button Suggest me If I can do this with the help of code behind inspite of javascript
 
Back
Top