jonthornton/jquery-timepicker

selectTime does not fire when selecting same time if using useSelect

dlsso opened this issue · 3 comments

dlsso commented

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.

Hello
I use this time picker. It is really nice.
I need some help like I use seconds as well.
I want time picker like
00:00:00
00:00:10
00:00:20
means I want 10-second interval I use steps in time picker but what function I need to write can you please help me.
timepicker

please help me,
Thank you

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,
    });
  });

https://prnt.sc/vanl26

For more options or customization read this documentation
https://cdn.jsdelivr.net/npm/timepicker@1.13.15/README.md