Friday, 25 May 2012

How to check radio button selected or not using jquery?

Folks,

Use the following code:

function validateMultipleRadio(formId){
        if(formId == undefined){
            var totalInput = $('input:radio').length;
        }else{
            var totalInput = $('#'+formId+' input:radio').length;
        }
        var checkedValues = '';
        if(totalInput > 0){
            $(":input:radio:checked").each(function(){
                checkedValues = checkedValues + ',' + this.value;
            })
        }
        return checkedValues;

}

var checkValues = validateMultipleRadio('frm');
alert(checkValues);



Cheers!

1 comment:


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Front end developer learn from javascript and jquery training in chennai .
    or learn thru Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. javascript and jquery training in chennai

    ReplyDelete