Calculate hour, minute in JavaScript or JQuery
Compare start time and end time with jquery.
After comparing/calculating we will get the difference between start & end time.
HTML
<input id="a1" type="text" />
<input id="a2" type="text" onblur="calculate()" />
<input id="a3" type="text" name="total_amt" />
JavaScript
calculate = function()
{
var start = document.getElementById('a1').value;
var end = document.getElementById('a2').value;
s = start.split(':');
e = end.split(':');
min = e[1]-s[1];
hour_carry = 0;
if(min < 0){
min += 60;
hour_carry += 1;
}
hour = e[0]-s[0]-hour_carry;
diff = hour + ":" + min;
document.getElementById('a3').value = diff;
//alert(diff);
}