I'm having some checkboxes, where all have different values but all numbers.
I want to get the values that are checked, and then add the numbers together and then display the result in my div.
<div id="pakker">
<input type="checkbox" value="39" />test 1<br/>
<input type="checkbox" value="79" />test 2<br/>
<input type="checkbox" value="29" />test 3<br/>
<input type="checkbox" value="49" />test 4<br/>
ect
</div>
What I have so far is this: var pakker = $('#pakker checkbox:checked').val();
UPDATE:
Where i want the result: <h1 id="sk">0</h1>
But it's not really working, although I'm not getting any errors.
Does anyone know how this can be done, as easily as possible?
checkboxas a selector but there's no such tag name. I believe you're looking for:checkbox(that leading colon is important!), and then you're going to have to use something different than.valto handle the multiple objects returned.