Time picker


This is a time picker that provides scroll wheel functionality on the individual time parts (hours, minutes, seconds and AM/PM)

There are known bugs... Setting the scroll listener on the document only means that if you use the scroll wheel fast enough then the page will still scroll. To get around this the window scroll also has a preventDefault on it whilst the input has focus, which could be problematic.

Note that this has only been tested (briefly) in IE and Firefox. If anybody has a use for this and wants it then let me know I and can do a more complete version. the code is also free for general use if you wish to improve it yourself. If I have a need for it myself at some point I'll do a more thorough version then regardless. In that instance it would probably be integrated into Tanto.

Click on the hours, minutes, seconds or AM/PM and use your scrollwheel. There is no additional keyboard interaction beyond typing in values, though double clicking on a section will highlight it and allow you to enter a value.

Get the code »



CoffeeScript in Action


CoffeeScript in Action book cover

I'm the author. Get it from Manning.