Compruebe si el botón de radio está marcado
$('#element').click(function() {
if($('#radio_button').is(':checked')) { alert("it's checked"); }
});
Pan Dziad
$('#element').click(function() {
if($('#radio_button').is(':checked')) { alert("it's checked"); }
});
$(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!');
}
});
});
if(document.getElementById('gender_Male').checked) {
//Male radio button is checked
}else if(document.getElementById('gender_Female').checked) {
//Female radio button is checked
}
//alert(document.querySelector('input[name = "comp"]:checked').value);
$test=document.querySelector('input[name = "comp"]:checked').value;
if($test="silver") {
amount=50;
}else if($test="gold") {
amount=90;
}else{
amount=30;
}
if ($('input[name='+ radioName +']:checked').length) {
// at least one of the radio buttons was checked
return true; // allow whatever action would normally happen to continue
}
else {
// no radio button was checked
return false; // stop whatever action would normally happen
}