Alternative solution for Timepicker Issue #51
https://github.com/wvega/timepicker/issues/51
by wvega
HTML
<script src="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.js"></script>
<link rel="stylesheet" href="http://timepicker.co/resources/jquery-timepicker/jquery.timepicker.min.css">
<input id="starttime" type="text" />
<input id="endtime" type="text" />
JavaScript
jQuery(function ($) {
$('#starttime').timepicker({
scrollbar: true,
change: function (time) {
setTimeout( function() {
var endtime = $( '#endtime' ),
instance = endtime.timepicker();
instance.setTime( time );
// select (as in highlight) next time entry after time
instance.next();
// set this field time to the time entry highlighted in the previous step
instance.setTime( instance.selected().text() );
// focus on the #endtime field to allow user to adjust the selected time,
// by typing another time entriy or selecting a new one with the UP and DOWN
// keys.
endtime.focus();
}, 10 );
}
});
});
jQuery(function ($) {
$('#endtime').timepicker({
scrollbar: true,
change: function (time) {
}
});
});