jQuery UI CaretSpinner / TimeSpinner / TimePicker

Preamble

jQuery UI recently introduced the spinner control. The issue I had with it was that the up/down buttons could only step a specific interval. I wanted to be able to step up depending on the current position of the cursor.

For example, the decimal example on their site can only increment by .01. In my improved version, the decimal will increment either by .01 or 1, depending on where the user's cursor is. Same for the time spinner.

Demo

Download

What you'll need (in this order):

  1. jQuery - http://jquery.com
  2. jQuery Caret - http://code.google.com/p/jcaret/downloads/list
  3. (optional) jQuery MouseWheel - https://github.com/brandonaaron/jquery-mousewheel/downloads
  4. jQuery UI Spinner - http://jqueryui.com/download/
  5. jQuery Caret Spinner - http://microalps.com/scripts/jquery.caret.spinner.js

ToDo

This widget is far from done. The below are on my todo. If you have any comments, reply in the jQuery Forums or shoot me an email and I'll add it to the list.

  • Expand library to include date formats
  • Allow for more relaxed parsing in the event I just can't figure it out
  • Handle never focused differently with a default step
  • Add getDate and setDate methods similar to the datepicker
  • Get this submitted to jQuery :)
© Copyright 2009–2024 microalps web services. All rights reserved.