how to set radio option checked onload with jQuery

Say you had radio buttons like these, for example:

    <input type="radio" name="gender" value="Male">
    <input type="radio" name="gender" value="Female">

And you wanted to check the one with a value of “Male” onload if no radio is checked:

    $(function() {
        var $radios = $('input:radio[name=gender]');
        if($radios.is(':checked') === false) {
            $radios.filter('[value=Male]').prop('checked', true);
        }
    });

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)