Need to get the values of checkbox
and need to store in a single variable
by adding all values instead of storing in array.how should i get it.?
here my fiddle and my jquery
function getCheck() {
$('ul.addon > li :checked').each(function() {
allVals.push($(this).val());
});
return allVals;
}
$(function() {
$('ul.addon > li > input').click(getCheck);
getCheck();
$(allVals).each(function(){
addon+=parseInt(allVals);
$('#op').html(addon);
});
});
here allvals array contain al the values of checked checkbox 1,2,1,1,3
Now i need to add those values and move into addon
variable like 1+2+1+1+3=8
and if i uncheck the checkbox the value must be minused i tried my best i did' t able to get it.. :( thanks in advance