title: Adding values in a checkbox, textbox and select using javascript
body: <p>How will I add my checkbox value to the list of being added? If it is checked, it will be added to the total, if unchecked it will not be added. Or if it is already checked, then the customer unchecked it it will be deducted from the total. </p>
  
  <p><strong>javascript</strong></p>
  
  <pre><code>function subtotal(){
  $("#as").on('change',function(event){
      var as = $(event.target).val();
      var txt1 = $('#sff').val();
      var txt2 = $('#osf').val();
      var d = 0;
  
      if ($('#cbx3').is(":checked")) {
          d = parseFloat($("#cbx3").val(), 10);
  
      var a = parseFloat(as, 10);
      var b = parseFloat(txt1, 10);
      var c = parseFloat(txt2, 10);
      var total = parseFloat(a, 10) + parseFloat(b, 10) + parseFloat(c, 10) + d;
  
  
      $('#st').val(total.toFixed(2));  
  }); 
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="text" id="txt1"/&gt; //automatically shows value depending on a dropdownmenu
  &lt;input type="text" id="txt2"/&gt; /automatically shows value depending on a dropdownmenu
  &lt;input type="text" id="gt"/&gt; //this is where the answers shows
  
  &lt;input type="checkbox" id="cbx3"/&gt;
  
  &lt;select id="as"&gt;
  &lt;option value="10"&gt;10&lt;/option&gt;
  &lt;option value="20"&gt;20&lt;/option&gt;
  &lt;option value="30"&gt;30&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>the <code>total</code> should be equivalent to, textbox1 + textbox2 + dropdownmenu + checkbox
  I have managed to add the textboxes and dropdown, the concern now is the checkbox.</p>
  
  <p>thankyou...</p>