title: jQuery/Javascript net salary calculator
body: <p>I've been working on this net salary calculator and everything seems to make sense as far as I can tell, yet the submit button doesn't seem to do anything it is supposed to.</p>
  
  <p>I'm not sure if there's anything I missed or any mistake I made somewhere that I just can't seem to find but any help would be great!</p>
  
  <p><a href="http://jsfiddle.net/Shibi/rcpfm4e2/" rel="nofollow">http://jsfiddle.net/Shibi/rcpfm4e2/</a></p>
  
  <pre><code>&lt;div id="page-wrap"&gt;
  &lt;div id="todo" ng-controller="TodoCtrl"&gt;
          &lt;h2&gt;Net Salary Calculator&lt;/h2&gt;
  
      &lt;div class="form-horizontal"&gt;
          &lt;form id="calculator"&gt;
              &lt;p&gt;Income:
                  &lt;input id="income" /&gt;
              &lt;/p&gt;
              &lt;select id="states" onchange="changetax(this)"&gt;
                  &lt;option&gt;Choose state&lt;/option&gt;
                  &lt;option value="4.0"&gt;Alabama&lt;/option&gt;
                  &lt;option value="0.0"&gt;Alaska&lt;/option&gt;
                  &lt;option value="5.60"&gt;Arizona&lt;/option&gt;
                  &lt;option value="6.50"&gt;Arkansas&lt;/option&gt;
              &lt;/select&gt;
              &lt;div id="tax"&gt;&lt;/div&gt;
              &lt;hr /&gt;
              &lt;p&gt;Taxed Amount:
                  &lt;input id="tax" disabled="disabled" /&gt;
              &lt;/p&gt;
              &lt;p&gt;Total:
                  &lt;input id="total" disabled="disabled" /&gt;
              &lt;/p&gt;
              &lt;p&gt;
                  &lt;input type="submit" /&gt;
              &lt;/p&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>function changetax($this) {
  
  var e = document.getElementById("states");
  var selectedState = e.options[e.selectedIndex].text;
  var x = document.getElementById("states");
  var selectedTax = x.options[x.selectedIndex].value;
  $("#tax").text($this.value ? ("Income Tax: " + selectedState + " " + selectedTax + "%") : "");
  }
  
  function calculate() {
  
  var income = $('#income').val();
  var tax = Number(income) * Number(selectedTax / 100);
  var total = Number(income) - (Number(tax) * Number(income));
  
  $('#tax').val(tax.toFixed(2));
  $('#total').val(total.toFixed(2));
  $('#calculator').submit(calculate);
  return false;
  }
  </code></pre>