The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id.
The problem is
$("#radioID") // select the radio by its id
.change(function(){ // bind a function to the change event
if( $(this).is(":checked") ){ // check if the radio is checked
var val = $(this).val(); // retrieve the value
}
});
Make sure to wrap this in the DOM ready function ($(function(){...});
or $(document).ready(function(){...});
).