1$('#element').click(function() {
2 if($('#radio_button').is(':checked')) { alert("it's checked"); }
3});
4
1$(document).ready(function(){
2 $('#submit_button').click(function() {
3 if (!$("input[name='name']:checked").val()) {
4 alert('Nothing is checked!');
5 return false;
6 }
7 else {
8 alert('One of the radio buttons is checked!');
9 }
10 });
11});
1if(document.getElementById('gender_Male').checked) {
2 //Male radio button is checked
3}else if(document.getElementById('gender_Female').checked) {
4 //Female radio button is checked
5}
1
2 if ($('input[name='+ radioName +']:checked').length) {
3 // at least one of the radio buttons was checked
4 return true; // allow whatever action would normally happen to continue
5 }
6 else {
7 // no radio button was checked
8 return false; // stop whatever action would normally happen
9 }
10