How to set radio option checked onload with jQuery?
Need to check if no default is set and then set a default
I liked the answer by @Amc. I found the expression could be condensed further to not use a filter() call (@chaiko apparently also noticed this). Also, prop() is the way to go vs attr() for jQuery v1.6+, see the jQuery documentation for prop() for the official best practices on the subject.
Consider the same input tags from @Paolo Bergantino's answer.
The updated one-liner might read something like:
$('input:radio[name="gender"][value="Male"]').prop('checked', true);