Thursday, 2 August 2012

How to check whether the radiobutton is checked or not using jquery:

Here i'm doing that the input field having name as gender were getting  to a variable and here our requirement is to know that whether it is cheked or not  then it will do alert if it is not cheked....


               var radiobuttons1 = $("input[name='gender']");
                        if (!radiobuttons1.filter(':checked').val()) {
                                 alert('Please select gender');}



For dropdown it is same... getting value for the options tag having the name then checking that whether it is selected and that value is not equal to already selected value then goes otherwise it'll leave alert.... do try for that also...... :)





No comments:

Post a Comment