I need Your help with little problem with Javascript. I want to make some simple application for taxes. I've made four inputs (income, costs, social insurance, health insurance).
Math looks like:[(income - costs - social ins.) * 18% - 556,02]
- health ins.
(I did it little different but it should be the same).
Final sum becomes "NaN" and I don't know why :( I'll post important code below:
var message = "Your tax is ";
var income = $("#income").val();
var costs= $("#costs").val();
var social= $("#social").val();
var health= $("#health").val();
var aaa;
var bbb;
var ccc;
var tax;
aaa = income-costs;
bbb = aaa-social;
ccc = bbb * 0.18 - 556.02;
tax = ccc-health;
And, the main page part:
<div data-role="main" class="ui-content">
<label for="income">income:</label>
<input type="number" name="income" id="income" value="0">
<label for="costs">costs:</label>
<input type="number" name="costs" id="costs" value="0">
<label for="social">social:</label>
<input type="number" name="social" id="social" value="0">
<label for="health">health:</label>
<input type="number" name="health" id="health" value="0">
<center><a href="#" data-role="button" data-inline="true" onclick="button_clicked(null);">Check Your tax</a></center>
</div>