title: How to subtract values of radio buttons
body: <p>How can I calculate a set of radio buttons using JavaScript?
  It works as of now with adding up the total. but I would like it to Subtract the $150.00 off. </p>
  
  <p>this is what I been working on now I get $Nan</p>
  
  <pre><code>&lt;p&gt;Baby Plan&lt;br /&gt;
      [radio BPSUBPT id:BPSUBPT class:radio-vertical "Baby Plan $300.00 3 Sessions" "Baby Plan $500.00 4 Sessions"] &lt;/p&gt;
  
  &lt;p&gt;Did you have a Newborn session With ADP? &lt;br /&gt;
  [radio BPSUPQ id:BPSUPQ class:radio-vertical "Yes$ -150 off" "No"]
  
  
  &lt;p&gt;Baby Plan Totals: &lt;br /&gt;
  Baby Plan Price: [text BPSUBPP 28/28 id:BPSUBPP]
  Discount Amount: [text BPSUDA 8/8 id:BPSUDA]
  
  Total Price: &lt;span id="total"&gt;&lt;/span
  
  
  
  &lt;script&gt;
          $(document).ready(function() {
        var inputs = $('input[name="BPSUBPT"], input[name="BPSUPQ"]');
              $(inputs).click(function() {
                  var total = 0;
                  $(inputs).filter(':checked').each(function() {
                      var value = ($(this).val()).match(/\$([0-9]*)/)[1];
                      total = (parseInt(total) - parseInt(value)) 
                  })
                 $('#total').html('$' + total);
              });
              $('input[name="BPSUBPT"]').click(function() {
                  $(this).blur();
                  $('#BPSUBPP').val($(this).val());
              })
              $('input[name="BPSUPQ"]').click(function() {
                  $(this).blur();
                  $('#BPSUDA').val($(this).val());
         });
          });
      &lt;/script&gt;
  </code></pre>