문제

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?

도움이 되었습니까?

해결책

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

다른 팁

It's working for server side control:

$("#<%=ControlID.ClientID%>").find(":checked").val();
$(".editor-field.radio-button-list:checked").val()

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top