I am selecting 2 inputs to calculate a value between hours using keypress
. My query is how I can perform the calculation only by pressing the% key% of%
$(document).ready(function() {
$('#horaInicio').timepicker({
'scrollDefault': 'now',
'timeFormat': 'G:i'
});
$('#horaTermino').timepicker({
'scrollDefault': 'now',
'timeFormat': 'G:i'
});
$("#horaTermino").keypress(function(event) {
ObtieneTotHoras();
})
});
function ObtieneTotHoras() {
var contar = 0;
HDesde = $('#horaInicio').val();
HHasta = $('#horaTermino').val();
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="" id="horaInicio" value=""> <br>
<input type="text" name="" id="horaTermino" value="">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.timepicker.js"></script>