selectTime does not fire when selecting same time if using useSelect
dlsso opened this issue · 3 comments
Normally selectTime fires even if you select the time that was previously selected. If using useSelect it only fires on change. I assume this is because it is difficult to detect this event on a select box (see http://stackoverflow.com/questions/647282/is-there-an-onselect-event-or-equivalent-for-html-select/12404521#comment16598702_7858323) but it would be really nice to have consistent behavior there or at least note it in the documentation.
Example:
http://jsfiddle.net/jLfv77ox/1/
Update:
I also noticed that when using useSelect hideTimepicker seems to fire on blur instead of on hide.
The two are related. Like you pointed out, it's difficult to detect an onSelect
equivalent for the native select element. In order to reliably fire the 'hideTimepicker' event it has to be attached to blur
.
I'll add a note to the documentation. Thanks for asking.
I used this script like this to add a 10-minute interval
$(function () {
$('.addtime').timepicker();
// Comment out the following line and you will see that normally the event will fire even if selecting the same time again
$('.addtime').timepicker('option', {
useSelect: true,
step: 10,
});
});
For more options or customization read this documentation
https://cdn.jsdelivr.net/npm/timepicker@1.13.15/README.md