$('#radio-button-id').click(function() {
if($('#radio-button-id').is(':checked'))
{
//input where you put a value
$('#program').val("radio-button-text");
}
});
$(document).ready(function(){
$('#submit_button').click(function() {
if (!$("input[name='name']:checked").val()) {
alert('Nothing is checked!');
return false;
}
else {
alert('One of the radio buttons is checked!');
}
});
});
/*
A quick way to check if a radio button as been checked is by using
the .is(":checked") fucntion. A small example below :)
*/
var myElem = jQuery('#elemId'); // select the radio element
var testResult = myElem.is(":checked"); // returns true if checked, else false