Loading…

How we can get the value of a radio button using Jquery?

When a radio button is selected addition check attribute is not added to it. You have to enter "checked".

Example

                                        

$(document).ready(function(){
    $("input[type='button']").on('click', function(){
       var radioValue = $("input[name='gender']:checked").val();
       if(radioValue){
          alert(radioValue);
       }
    });
});

Suggest An Answer

No suggestions avaliable!

Latest post from JQuery interview questions

Ask Question