jQuery UI | Spinner to select numeric data
Spinner in jQuery UI is used to increase or decrease the value by using arrow keys or by using up/down buttons. This spinner is used for numeric inputs.
We will use the CDN link in code to add different libraries and styles. To display this Calendar like any other jQuery UI widget, we have to link to jQuery and jQuery UI. Here is a simple code with all HTML tags to display a spinner. You can just copy this code to display the spinner.
Example 1:
<!DOCTYPE html> <html> <head> <title> jQuery UI | Spinner to select numeric data </title> <link href= themes/ui-lightness/jquery-ui.css' rel='stylesheet'> <script src= </script> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3> jQuery UI | Spinner to select numeric data </h3> <input id="spinner" size=3 value=17> <script> $(document).ready(function() { $( "#spinner" ).spinner(); }); </script> </body> </html> |
Output:

Default value: It is used to set the default value to the input box.
Example 2:
<!DOCTYPE html> <html> <head> <title> jQuery UI | Spinner to select numeric data </title> <link href= themes/ui-lightness/jquery-ui.css' rel='stylesheet'> <script src= </script> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3> jQuery UI | Spinner to select numeric data </h3> <input id="spinner" size=3> <script> $(document).ready(function() { $( "#spinner" ).spinner(); $( "#spinner" ).val(500) }); </script> </body> </html> |
Output:

Maximum and Minimum value: It can be set the Upper and Lower limits for the spinner.
<script> $(document).ready(function() { $( "#spinner" ).spinner({ max: 20, min: -10 }); }); </script> |
Page value: We can set the value of Page up or Page down key button value by using page value.
<script> $(document).ready(function() { $( "#spinner" ).spinner({ page:50 }); }); </script> |
Step Value: We can set the value of up arrow or down arrow key button value by using step.
<script> $(document).ready(function() { $( "#spinner" ).spinner({ step:10 }); }); </script> |
Recommended Posts:
- How to check whether a value is numeric or not using jQuery ?
- How to select an element by name with jQuery?
- jQuery | select() with Examples
- Get the numeric part of CSS property using jQuery
- How to select all on focus in input using JQuery?
- How to select ID that starts with certain character using jQuery ?
- How to select elements by attribute in jQuery ?
- How to add options to a select element using jQuery?
- How to select all elements without a given class using jQuery ?
- How to select text nodes using jQuery ?
- How to select first element in the drop-down list using jQuery ?
- How to fire an event on file select using jQuery ?
- How to remove options from select element using jQuery ?
- How to select elements by data attribute using CSS?
- jQuery | data() with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



