« Return to Thread: JQuery Plugin: SpinBox / SpinButton Control (with no extra markup)

Re: JQuery Plugin: SpinBox / SpinButton Control (with no extramarkup)

by Jörn Zaefferer :: Rate this Message:

Reply to Author | View in Thread

Hi George,

very nice work so far.

Some ideas:
- min, max and increments would be very useful and quite easy to implement
- concerning 'disallow non-numeric text': Sam wrote a plugin that does
exactly this ( http://sam.collett.googlepages.com/numeric.html )
- the perfect spinbutton could do this: up/down keys to in-/decrease;
up-/down-buttons single click for single step; hold up-/down-buttons for
repeated steps; click, hold and drag either button to in-/deacrease, based
on direction
- non numeric data as dates are rather uninteressting, as there are very
nice date pickers available; on the other hand, a spin button for time for
be great
- for avoiding namespace cluttering and easy option parsing there are some
tricks available - I learned these from jQuery itself and several plugins
and used them in a plugin of mine, if you are interesseted, have a look at
it: http://fuzz.bassistance.de/jQueryFormValidation/js/validate.js - Most
interesseting should be the start till this line:
jQuery.extend(this.settings, options);
If you apply this to your code, your syntax could look like this:
var options = {
 min: 0,
 max: 200,
 step: 5
}
$('input.spinMe').spinButton(options);

Something you should definitly change: Load a copy of jQuery from your own
server and remove the link zu jQuery.com. This is a something that remained
in the official docs. Please have a look at the updated tutorial here:
http://proj.jquery.com/docs/Tutorials/Basics/

I added your plugin (and Sam's numeric plugin) to the plugin page, so
everybody can find it: http://proj.jquery.com/docs/Plugins/

-- Jörn


_______________________________________________
jQuery mailing list
discuss@...
http://jquery.com/discuss/

 « Return to Thread: JQuery Plugin: SpinBox / SpinButton Control (with no extra markup)