Tag Archives: JQuery: How to get value of ckecked checkbox

JQuery: How to get value of ckecked checkbox

JQuery: How to get value of ckecked checkbox

[javascript]
function getCheckedId()
{
var allVals = [];
$("input[type='checkbox']:checked").each(function() { allVals.push($(this).val());
});

if( ! allVals ) return false;

len = allVals.length;

if( len == 0) return 0;

if (len >1) {
alert("More than one vehicle selected. Only one will be processed. ");
}

return allVals[0];
}

[/javascript]