With jQuery, it'd be something like
if ($('input[name=gender]:checked').length > 0) { // do something here } Let me break that down into pieces to cover it more clearly. jQuery processes things from left to right.
input[name=gender]:checked inputinputlimits it to input tags.[name=gender][name=gender]limits it to tags with the name gender within the previous group.:checked:checkedlimits it to checkboxes/radio buttons that are selected within the previous group.
If you want to avoid this altogether, mark one of the radio buttons as selectedchecked (checked="checked") in the HTML code, which would guarantee that one radio button is always selected.