1

Iv been stuck on this one for over a month now, really really need help on this one,

I want to use Jquery ui spinner with following customizations :

  1. The increment up and down button should be defined by me, my images should be used
  2. The increment step size should be variable

Another other approach , than using jquery ui would be welcomed but need help to achieve this , basic functionality im looking for is : till mousedown on image keep incrementing textbox value, thats it

3 Answers 3

3

you can try with:

       https://github.com/btburnett3/jquery.ui.spinner

Is easy to use and you only need 2 files (ui.spinner.min.js or ui.spinner.js and ui.spinner.css)

Answering to your questions:

  1. You can override any of the css classes listed below to put your desired image, and play with some values in the browser development tool to see your changes.

        classes: ui-spinner-up ui-spinner-button ui-state-default ui-corner-tr
    
  2. The increment size could be set in the 'step' property.

Example:

$('#someId').spinner({
                        min: 0,
                        max: 100,
                        increment:'fast',
                        step:5  // this will increment or decrement by 5    
                    });

Remember that the HTML component with id="someId" should be an input with type="text" or "number" but if you choose the last one and your browser support HTML5 it will render the up/down arrow inside the input and below the buttons added by this extension. My suggestion is to use type="text".

Cheers.

Sign up to request clarification or add additional context in comments.

4 Comments

naah i dont want to do all this , i just need the simple spinner describe in the question
I reply again with another approach, I hope that helps. Regards.
@NishantJani Reads very much like “No, I don’t want to learn how the technology works, just give me a working solution.”
".ui-widget" is also important.
0

If you look at the latest version in github for spinner, https://github.com/jquery/jquery-ui/tree/master/ui They have added code in the last commit for spinner to have option to change images. As far as increment step size is concerned you can add the step value in options. Hope this helps.

Comments

0

I forgot mention that you can use jQuery UI 1.9, in the milestone 6 they were featuring many updates for the Spinner widget.

Please visit this site for further details: JQuery UI 1.9 milestone 6

Remember that this feature is 'in development', the visual design looks good but the working spinner looks like this example

For your purposes:

  1. The images could be changed by CSS.
  2. The option 'step' should provide the increment step size.
  3. Till mousedown on image keep incrementing textbox is working as you expect.

Note: Remember that you can download the first release candidate of JQuery UI 1.9 RC, to test that.

I hope this helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.