Q:

Auto calculate value including decimals

I have a html form where users add hours to 5 input fields (days of the week).
The total hours is then displayed at the bottom of the form.
This is working fine for rounded hours, but when adding something like 7.4 the total is rounding it to 7
See below:
Is there a way to add the decimals too?

$(document).ready(function() {
  $('.calc').change(function() {
    var total = 0;
    $('.calc').each(function() {
      if ($(this).val() != '') {
        total += parseInt($(this).val());
      }
    });
    $('#total').html(total);
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" class="form-control  calc" name='mon'>
<input type="text" class="form-control  calc" name='tue'>
<span id="total"></span>

A:

As @MysterX pointed out, you are converting the user's input into integer(whole number) form. parseFloat will account for decimal places.

