Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

jQuery UI Spinner step Option

  • Last Updated : 01 Feb, 2021

The jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI spinner widget helps us to increment and decrement values of an input element using the up and down arrow. In this article, we will see how to use the step Option in the jQuery UI slider. The step option is used to indicate the number of steps to be taken in the jQuery UI spinner. By default, the value is 1.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

$( ".selector" ).spinner(
   { step : number | 'string'}
);

Parameters: This option accepts two parameters as mentioned above and described below:

  • number: This parameter size of the step.
  • string: This parameter will be parsed based on the numberFormat and culture options, otherwise it will fall back to the native parseFloat() method.

CDN Link: First, add jQuery UI scripts CDN link, needed for your task.



<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>

<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>

<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>

Example 1: In this example, we increase the value of the spinner by 50 in each step.

HTML




<!DOCTYPE html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <link href
            rel = "stylesheet" />
      <script src
     </script>
      <script src
     </script>
        
      <script>
         $(function() {
            $( "#gfg" ).spinner( 
               {step: 50}
            );
         });
      </script>
   </head>
     
   <body>
      <h1>GeeksforGeeks</h1
      <h2>jQuery UI | spinner step option</h2>
      <div id = "geeks">
         <input type = "text" id = "gfg" value = "45" />
      </div>
   </body>
</html>

Output:

Reference: https://api.jqueryui.com/1.11/spinner/#option-step




My Personal Notes arrow_drop_up
Recommended Articles
Page :