if condition for radio button using jQuery

I need to find out if radio button is checked using jQuery. I was knowing one way to find out but there are couple of other ways as well to find out if radio button is checked using jQuery. You may also like How to checkbox checked using jQuery and How to radio button checked using jQuery.

HTML Code

<div class="col-md-12">
    <label class="col-sm-2 label-on-left" style="text-align: left;">QR Manager Send Mail
            <input type="radio"  value="1"      required     name="mailSendManager" class="mailSendManager" style="margin-left: 10px;"></label> 
    <label class="col-sm-2 label-on-left" style="text-align: left;">HR Manager Send Mail
            <input type="radio"  value="2"  required      name="mailSendManager" class="mailSendManager" style="margin-left: 10px;"></label> 
    <label class="col-sm-2 label-on-left" style="text-align: left;">Dev Manager Send Mail
            <input type="radio" value="3"  required     name="mailSendManager" class="mailSendManager"  style="margin-left: 10px;"></label> 
</div>

Jquery Code

var getradio = $('.mailSendManager:checked').val();
if(getradio != undefined)
{
   alert('Success');
}
else
{
   alert('Not Success');
}

Leave a Reply

Your email address will not be published. Required fields are marked *