How to get value from RadioButtonList using jQuery?

CodeName-2956981 picture CodeName-2956981 · Dec 9, 2013 · Viewed 35.1k times · Source

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?

Answer

Adam Rackis picture Adam Rackis · Dec 9, 2013

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()