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!
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!
No comments:
Post a Comment