Problem with calculation
Problem with calculation
- <script language="JavaScript" type="text/javascript">
- $(document).ready( function() {
- $(".chkOptions").click(
- function () {
- var ntot = 0;
- var multiplier = $('#multiplier').val();
- var ans = $('.chkOptions').val();
- $(".chkOptions:checked").each(function () {
- ans = multiplier * ans;
- ntot += parseInt($(this).val());
- });
- $("#txtSavingsTot").val(ntot);
- })
- .change();
- });
- </script>
- Hi I am having a problem with calculating values. Ah the first thing it should do is multiply the hidden value to the checkbox value and get the sum of the after. .
- <input type="hidden" id="multiplier" value="500" />(The value value 500 is just an assumption)
- <input type="checkbox" class="chkOptions" value="12" /> ---- ANS
- <input type="checkbox" class="chkOptions" value="13" /> ---- ANS
- SUM
- Can u actually please help me. . .I am stuck. . Thanks