Skip to content
Related Articles

Related Articles

jQuery UI Slider min Option
  • Last Updated : 02 Mar, 2021

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. jQueryUI provides us a slider control through the slider widget. Slider helps us to get a certain value using a given range. In this article we will see how to set the min option in a slider. The min option is used to set the lower range of the slider.

Syntax:

$(".selector").slider(
   { min : 20}
);

Parameters: This option accepts one parameter as discussed below.

  • number : The lower range of the slider to be set. By default, the value is 0
     

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

<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 will be using the minimum number value as 2.

HTML




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link href=
      rel="stylesheet"/>
    <script src=
    </script>
    <script src=
    </script>
  
    <script>
      $(function () {
        $("#gfg").slider({ min: 2, max: 8 });
      });
    </script>
  </head>
  
  <body>
    <h1>GeeksforGeeks</h1>
    <h2>jQuery UI | slider min option</h2>
    <div id="gfg"></div>
  </body>
</html>

Output:

Example 2: In this example, we will be using the range option with values and min, max number values for the slider as 0 and 100 respectively. 

HTML




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link href=
      rel="stylesheet"/>
    <script src=
    </script>
    <script src=
    </script>
  
    <script>
      $(function () {
        $("#gfg").slider({
          range: true,
          values: [20, 40],
          min: 0,
          max: 100,
        });
      });
    </script>
  </head>
  
  <body>
    <h1>GeeksforGeeks</h1>
    <h2>jQuery UI | slider min option</h2>
    <div id="gfg"></div>
  </body>
</html>

Output:

Reference: https://api.jqueryui.com/slider/#option-min

My Personal Notes arrow_drop_up
Recommended Articles
Page :