Hi all,
I am currently using 2 single line fields for keeping time on subjects spoken about and 1 single field line for the total of the 2. I am tracking hours and minutes for each. my problem is attempting to add the fields together for a total. this is the script I found somewhere:
$(document).ready(function () { $('.sum').on('blur', 'input', sumtotal); function sumtotal() { var s = 0; $('.sum input').each(function () { s += parseNumber($(this).val()); }); $('.total input').val(s); } function parseNumber(n) { var f = parseFloat(n); //Convert to float number. return isNaN(f) ? 0 : f; //treat invalid input as 0; } });
in the CSS of the two fields I put "sum" and in the total field I put "total". So if I enter 01:30 in one field and 00:30 in the other all I get in the total is 0 when I should get 2:00. This is what I use for Regular expression for validation on all of the lines:
I tried the time field but it doesn't do what I need.
If anyone can make sense of this and would help me, I would greatly appreciate it.
Donnie