How to have the value of the selected in radioButtonList
<html>
<asp:RadioButtonList runat="server" CssClass="status_Veh">
<asp:ListItem ID="RadioButton1" runat="serve开发者_运维技巧r" name="status" Selected="True" Value="New">New</asp:ListItem>
<asp:ListItem ID="RadioButton2" runat="server" name="status" Value="Used" >Used</asp:ListItem>
</asp:RadioButtonList>
</html>
need to have the selected value of the radio buttonList using Jquery
I'm using
var statusVeh = $(".status_Veh option:selected ").val();
it isn't working
nor is
var statusVeh = $(".status_Veh:checked").val();
Try $(".status_Veh input:checked").val();
RadioButtonList generates , so the option:selected selector won't work.
$(".status_Veh:checked").val() is not working, because you have to look the .status_Veh elements children for checked values. So $(".status_Veh :checked").val() should also work (notice the space in the selector).
you can try $('input[name=status]:checked').val()
精彩评论