Yelotofu

Yelotofu ~ “In building standards compliant sites we are creating a better Web for the future.”

jQuery Numeric Stepper

Tags: , , , , , ,

As an experiement I ported over my Accessible Numeric Stepper into a jQuery widget and added some accessibility enhancements and new features in the process.

This widget utilises ui.core.js - a factory method object for creating widget classes. Widgets in jQuery are essentially plugins at heart but built to follow stricter coding standards in order to unify the underlying quality between developers. It also adds convenient mouse interaction classes and option settings among other things.

The result is jQuery Numeric Stepper an unofficial jQuery UI widget. Features include:

  • min, max, start and step size settings
  • supports decimal values and decimal step sizes
  • supports currency values
  • keyboard and mousewheel interaction - increment/decrement values via cursor keys, +/- keys and mousewheel

Download latest source code here

Bugs? Missing feature? Code improvements? Let me know!

Update: Features seen here are now part of the official jQuery UI Spinner, set for the 1.6 release of jQuery UI. More details.

Similar Posts

7 Comments

  1. By Richard D. Worth at

    Very nice work! I would offer only two suggestions: It would be nice if you could hold down a button instead of having to click click click. Same thing with an up or down key.

    Love the mousewheel interaction. Thanks for sharing.

  2. By caphun at

    @richard: Just updated ui.stepper.js to include the mouse hold feature you suggested. Get latest via same download link.

    This was pretty easy to add as I basically copied ui.spinner.js for this part.

    Will look into the hold feature on up down keys.

  3. By caphun at

    OK, made some improvements.

    * Holding up and down keys now supported
    * Did some code refactoring
    * A change event fires after keyboard or mouse release.

  4. By Laurence at

    Bravo !!
    But why is the numpad disabled on the input text ?

  5. By caphun at

    Thanks Laurence, that is now fixed!

  6. By Laurence at

    What a reactivity !
    I added also a ‘type=”button”‘ for spinner-up and spinner-down because Firefox treated them like submit buttons.
    Thanks for sharing !

  7. By Recent Links Tagged With "stepper" - JabberTags at

    [...] Stamina Extended Stride Elliptical Stepper - Best Price! Saved by thepinkbismuth on Mon 29-9-2008 jQuery Numeric Stepper Saved by kubaKT on Mon 29-9-2008 Stamina SpaceMate Folding Stepper Saved by pllyrain on Mon [...]

Leave a Reply

* marks a required field.



(this will not be published)