radiobutton check
radiobutton check
hi
i have an asp.net radiobutton control and want to get the selected value in jquery
the control is coded as this
<asp:RadioButton ID="radFree" runat="server" GroupName="deliveryoptions" />
<p><span class="selection-free">(FREE)</span> First Class Recorded (1-3 Business Days)</p>
<br class="clear" />
<asp:RadioButton ID="radSpecial" runat="server" GroupName="deliveryoptions" />
<p><span class="selection-special">(£4.99)</span> Special Delivery (Next Day)</p>
then in my js file im trying to get the vlaue of the checked radio button with this code
if ($('#radFree:checked').val() == 'true') {
var deliverymethod = $('#radFree:checked').val();
}
else if ($('#radSpecial:checked').val() == 'true') {
var deliverymethod = $('#radSpecial:checked').val();
}
else {
var deliverymethod = 0;
}
but deliverymethod is always 0 so this isnt correct at detecting the radiobutton value
whats the right way to grab the radiobutton value of the selected option?