I'm trying to get the id of the set of radio buttons. Here is the HTML for it.
<input id="1" type="radio" title="2" value="6/1/2010" name="vacationDay">
<input id="2" type="radio" title="2" value="6/2/2010" name="vacationDay">
<input id="3" type="radio" title="2" value="6/3/2010" name="vacationDay" checked='checked'>
Here is my Javascript.
var updateDay = $('input[name=vacationDay]:checked').val();
It returns the value (6/3/2010) of the selected radio button . I would like to get the id of the checked button (3) as well. Ideas?
var $radio = $('input[name=vacationDay]:checked');
var updateDay = $radio.val();
var id = $radio.attr('id');
.attr()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With