How to get value from RadioButtonList using jQuery?
Asked Answered
K

4

5

I need to find out what is the selected value of RadioButtonList:

<div class="editor-field radio-button-list">
   <%= Html.RadioButtonListForEnum("Type", Model.Type)%>
</div>

I tried to use: $("#Type").find(":checked").val() but all I get is "undefined"... Any ideas?

Kwa answered 9/12, 2013 at 17:11 Comment(1)
Can you post the rendered HTML instead of whatever code that is?Jerlenejermain
L
14

I'm not sure the id of Type is coming out how you think it is. Or maybe Type is a duplicate Id. In any event, I think this is what you want

$(".editor-field.radio-button-list").find(":checked").val()
Leftover answered 9/12, 2013 at 17:41 Comment(0)
W
5

It's working for server side control:

$("#<%=ControlID.ClientID%>").find(":checked").val();
Wriggle answered 30/6, 2014 at 10:17 Comment(0)
B
2
$(".editor-field.radio-button-list:checked").val()
Bathurst answered 4/4, 2014 at 7:24 Comment(0)
H
0

var val = $('#<%= ControlID.ClientID %> input:checked').val();

Hersey answered 1/12, 2016 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.