Page 2 of 2

Re: Calculate time difference on subform

Posted: Fri May 29, 2020 12:19 pm
by kknm
Understood! All OK !
The problem is in the line:

Code: Select all

if (a.val() == 1) {//was if (a == '1') 

Code: Select all

 updateDuration(t1, t2, d, a, e);

Re: Calculate time difference on subform

Posted: Fri May 29, 2020 1:32 pm
by kev1n
Meaningful variable names help to make code more readable and easier to understand.

E.g. like this:

Code: Select all

var beg = $("#" + prefix + "pro_beg");
var end = $("#" + prefix + "pro_end");
var diff1  = $("#" + prefix + "pro_dif");
var diff2  = $("#" + prefix + "pro_diff");
var devNum  = $("#" + prefix + "pro_num");

Re: Calculate time difference on subform

Posted: Fri May 29, 2020 2:13 pm
by kknm
kev1n wrote:Meaningful variable names help to make code more readable and easier to understand.
Early rejoiced, Counts only the first line. - fixed.
I need to display the sum of the differences for each device