title: Retain TextBox value when CheckBox is checked
body: <p>I have a set of <code>TextBox</code> that will automatically compute the 'total' based on 'gross amount' (<strong>user input</strong>). 
  Each text box has a condition that is based on another text box. </p>
  
  <p>My computation works perfectly, but I need a <code>CheckBox</code> to allow the user to decide whether to remove the 'tax' or retain it. Every time the <code>CheckBox</code> is checked, the value of the text boxes that I have became zero. Can anyone help me with this?</p>
  
  <p>Here is what I have so far.</p>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>$(document).ready(function () {
              Number.prototype.formatMoney = function (c, d, t) {
                  var n = this,
                  c = isNaN(c = Math.abs(c)) ? 2 : c,
                  d = d == undefined ? "." : d,
                  t = t == undefined ? "," : t,
                  s = n &lt; 0 ? "-" : "",
                  i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
                  j = (j = i.length) &gt; 3 ? j % 3 : 0;
                  return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
              };
  
          });
  
          $(document).ready(function () {
              $(this).keyup(function aa() {
  
                  $("input[name='txtbx_less']").each(function (index) {
                      var txtbx_gross = $("input[name='txtbx_gross']").eq(index).val().replace(/,/g, "");
                      var txtbx_less = parseFloat(txtbx_gross) * 0.15;
  
                      if (!isNaN(txtbx_less)) {
                          $("input[name='txtbx_less']").eq(index).val(txtbx_less.formatMoney());
                      }
  
                  });
  
                  $("input[name='txtbx_net']").each(function (index) {
                      var txtbx_gross = $("input[name='txtbx_gross']").eq(index).val().replace(/,/g, "");
                      var txtbx_less = $("input[name='txtbx_less']").eq(index).val().replace(/,/g, "");
                      var txtbx_net = parseFloat(txtbx_gross) - parseFloat(txtbx_less);
  
                      if (!isNaN(txtbx_net)) {
                          $("input[name='txtbx_net']").eq(index).val(txtbx_net.formatMoney());
                      }
  
                  });
  
                  $("input[name='txtbx_add']").each(function (index) {
                      var txtbx_net = $("input[name='txtbx_net']").eq(index).val().replace(/,/g, "");
                      var txtbx_add = parseFloat(txtbx_net) * 0.12;
  
  
                      if (!isNaN(txtbx_add)) {
                          $("input[name='txtbx_add']").eq(index).val(txtbx_add.formatMoney());
                      }
                      else
                          $("input[name='txtbx_add']").eq(index).val("0.00");
  
                  });
  
                  $("input[name='txtbx_billed']").each(function (index) {
                      var txtbx_net = $("input[name='txtbx_net']").eq(index).val().replace(/,/g, "");
                      var txtbx_add = $("input[name='txtbx_add']").eq(index).val().replace(/,/g, "");
                      var txtbx_billed = parseFloat(txtbx_net) + parseFloat(txtbx_add);
  
                      if (!isNaN(txtbx_billed)) {
                          $("input[name='txtbx_billed']").eq(index).val(txtbx_billed.toFixed(2));
                      }
                  });
  
  
                  $("input[name='txtbx_add1']").each(function (index) {
                      var txtbx_net1 = $("input[name='txtbx_net1']").eq(index).val().replace(/,/g, "");
                      var txtbx_add1 = parseFloat(txtbx_net1) * 0.12;
  
  
                      if (!isNaN(txtbx_add1)) {
                          $("input[name='txtbx_add1']").eq(index).val(txtbx_add1.formatMoney());
                      }
  
                  });
  
                  $("input[name='txtbx_billed1']").each(function (index) {
                      var txtbx_net1 = $("input[name='txtbx_net1']").eq(index).val().replace(/,/g, "");
                      var txtbx_add1 = $("input[name='txtbx_add1']").eq(index).val().replace(/,/g, "");
                      var txtbx_billed1 = parseFloat(txtbx_net1) + parseFloat(txtbx_add1);
  
                      if (!isNaN(txtbx_billed1)) {
                          $("input[name='txtbx_billed1']").eq(index).val(txtbx_billed1.formatMoney());
                      }
                  });
  
  
  
              });
  
  
          });
  </code></pre>
  
  <p><strong>Front-end</strong></p>
  
  <pre><code>&lt;table class = "billcomp"&gt;
    &lt;tr&gt;
      &lt;td class = "prebiltd"&gt;GROSS AMOUNT :&lt;/td&gt;                          
      &lt;td class = "prebiltd"&gt;
        &lt;dx:ASPxTextBox ID="txtbx_gross" runat="server" Width="170px" Theme="Material"&gt;
          &lt;MaskSettings Mask="&lt;0..99999999g&gt;.&lt;00..99&gt;" /&gt;
        &lt;/dx:ASPxTextBox&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td class = "prebiltd"&gt;LESS: 15% ASF :&lt;/td&gt;
      &lt;td class = "prebiltd"&gt;
        &lt;dx:ASPxTextBox ID="txtbx_less" runat="server" Width="170px" Theme="Material"&gt;
          &lt;MaskSettings Mask="&lt;0..99999g&gt;.&lt;00..99&gt;" /&gt;
        &lt;/dx:ASPxTextBox&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td class = "prebiltd"&gt;NET AMOUNT :&lt;/td&gt;
      &lt;td class = "prebiltd"&gt;
        &lt;dx:ASPxTextBox ID="txtbx_net" runat="server" Width="170px" Theme="Material"&gt;
          &lt;MaskSettings Mask="&lt;0..99999g&gt;.&lt;00..99&gt;" /&gt;
        &lt;/dx:ASPxTextBox&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;
        &lt;asp:CheckBox runat="server" ID="chckbox_nonvat" Text="NON-VAT" /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td class = "prebiltd"&gt;ADD 12% VAT :&lt;/td&gt;
      &lt;td class = "prebiltd"&gt;                                         
        &lt;dx:ASPxTextBox ID="txtbx_add" runat="server" Width="170px" Theme="Material"&gt;
          &lt;MaskSettings Mask="&lt;0..99999g&gt;.&lt;00..99&gt;" /&gt;
        &lt;/dx:ASPxTextBox&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td class = "prebiltd"&gt;BILLED AMOUNT :&lt;/td&gt;
      &lt;td class = "prebiltd"&gt;
        &lt;dx:ASPxTextBox ID="txtbx_billed" runat="server" Width="170px" Theme="Material"&gt;
          &lt;MaskSettings Mask="&lt;0..99999g&gt;.&lt;00..99&gt;" /&gt;
        &lt;/dx:ASPxTextBox&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>