Bootstrap Timepicker not hidden?
I am using bootstrap timepicker, but it doesn't hide when I use the tab. It only hides when pressed. On focus using the timepicker tab, but on the lost focus tab the timepicker does not close.
Below is my code
$('#frmtime').timepicker({
defaulttime: false
}).on('changeTime.timepicker', function (e) {
disableFocus: true;
alert('The time is ' + e.time.value);
$(this).timepicker('hide');
});
How to hide timepicker value in change event.
+3
source to share
2 answers
Yes, I have this problem too. after many tries I fixed it with code like this:
$('.tp-start, .tp-end')
.on('focus', function() {
$(this).timepicker({
defaultTime: false,
minuteStep: 1,
showMeridian: false
});
})
// EDIT:
.on('blur', function(e) {
if ($(e.target).hasClass('tp-start') || $(e.target).hasClass('tp-end')) {
// do nothing or other thing you wanna do.
} else {
$(this).timepicker('hideWidget');
}
});
//.tp-start, .tp-end are inputs of time-start & time-end
It's more concise!
0
source to share