I couldn't add 3 numbers from inputs together. instead of adding them, it displays the numbers. Ex: 1+2+3= it becomes 123 instead of 6. It works well for the Earning but the deduction is causing the problem. any suggestion?
This is my script:
<script>
function getTotal() {
//total earnings
var morning_rate = document.salaries.morning_rate.value;
var morning_day = document.salaries.morning_day.value;
var night_rate = document.salaries.night_rate.value;
var night_day = document.salaries.night_day.value;
var earning = ((morning_rate * morning_day) + (night_rate * night_day));
//DEDUCTION
var uniform = document.salaries.uniform.value;
var damage = document.salaries.damage.value;
var othe = document.salaries.others.value;
var totalDec = (uniform + damage + other);
//NET SALARY
var net_salary = (earning - totalDec);
//RESULT
document.getElementById('total_earning').value = earning
document.getElementById('total_dec').value = totalDec
document.getElementById('net_salary').value = net_salary
}
</script>