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. jQuery UI 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 max option in a slider. The max option is used to set the upper range of the slider.
Syntax:
$(".selector").slider(
{ max : 20}
);
Parameters: This option accepts one parameter as discussed below.
- number: The upper range of the slider to be set.
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 a max number value as 15.
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(
{max : 15}
);
});
</ script >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >jQuery UI | slider max option</ h2 >
< div id = "gfg" ></ div >
</ body >
</ html >
|
Output:

Example 2: In this example, we will be using the range option with min, max number value as 0 and 500.
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,
min: 0,
max: 500,
values: [ 100, 300 ],
});
});
</ script >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >jQuery UI | slider max option</ h2 >
< div id = "gfg" ></ div >
</ body >
</ html >
|
Output:

Reference:https://api.jqueryui.com/slider/#option-max
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
02 Mar, 2021
Like Article
Save Article