Problem with calculation

Problem with calculation

  1. <script language="JavaScript" type="text/javascript"> 
  2.         $(document).ready( function() {
  3.          $(".chkOptions").click(
  4.          function () {
  5.          var ntot = 0;
  6.                     var multiplier = $('#multiplier').val();
  7.                     var ans = $('.chkOptions').val();
  8.          $(".chkOptions:checked").each(function () {
  9.                         ans = multiplier * ans;
  10.          ntot += parseInt($(this).val());
  11.          });
  12.          $("#txtSavingsTot").val(ntot);
  13.          })
  14.          .change();
  15.         });
  16.         </script> 

  17. 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. . 

  18. <input type="hidden" id="multiplier" value="500" />(The value value 500 is just an assumption)

  19. <input type="checkbox" class="chkOptions" value="12" />  ---- ANS
  20. <input type="checkbox" class="chkOptions" value="13" />  ---- ANS

  21.                                                                                           SUM

  22. Can u actually please help me. .  .I am stuck.  .  Thanks