1// jQuery version 1.6 or above use:
2$("#myRadioID").prop("checked", true);
3
4//jQuery versions below 1.6 use:
5$("#myRadioID").attr('checked', 'checked');
1$('#element').click(function() {
2 if($('#radio_button').is(':checked')) { alert("it's checked"); }
3});
4
1$('input:radio[name="postage"]').change(function(){
2
3 if ($(this).val() == 'Yes') {
4 //true
5 }
6 else {
7 //false
8 }
9 });
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});
1//<input type="radio" name="book_condition" value="3" >
2$("input:radio[value='3'][name='book_condition']").prop('checked',true);