Posts

Showing posts with the label Checked

Check First Radio Button With JQuery

Answer : If your buttons are grouped by their name attribute, try: $("input:radio[name=groupName][disabled=false]:first").attr('checked', true); If they are grouped by a parent container, then: $("#parentId input:radio[disabled=false]:first").attr('checked', true); $("input:radio[name=groupX]:not(:disabled):first") This should give you the first non-disabled radio-button from a group... The below does what you want: $(document).ready( function(){ $('input:radio:first-child').attr('checked',true); } ); Demo at: JS Bin.