jQuery UI Spinner option() method
Last Updated :
25 Feb, 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. jQuery UI spinner widget helps us to increment and decrement values of input element using up and down arrow. In this article, we will see how to use option() method in jQuery UI slider. The option() method is used to get an object for the particular current slider option in the jQuery UI spinner.
Syntax:
var a = $(".selector").spinner("option");
var a = $(".selector").spinner("optionName","value");
var a = $(".selector").spinner("options");
Approach:
- 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: The following code demonstrates the .spinner(option) method.
HTML
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<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>
<style type = "text/css">
#gfg input {width: 100px}
</style>
<script>
$(function() {
$("#gfg").spinner();
$('button').button();
var a = $("#gfg").spinner("option");
console.log(a)
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner option method</h2>
<input id = "gfg" />
</body>
</html>
Output:
Console output:
Example 2: The following code demonstrates the .spinner(optionName,value) method.
HTML
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<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>
<style type = "text/css">
#gfg input {width: 100px}
</style>
<script>
$(function() {
$("#gfg").spinner();
$('button').button();
var a = $("#gfg").spinner("option","disabled",true);
console.log(a)
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner option method</h2>
<input id = "gfg" />
</body>
</html>
Output:
- When the disabled option is false, it gives the following output.

- When the disabled option is true, it gives the following output.
Example 3: The following code demonstrates the .spinner(options) method. The following code has 2 options like { disabled: false,step: 2 }.
HTML
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<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>
<style type = "text/css">
#gfg input {width: 100px}
</style>
<script>
$(function() {
$("#gfg").spinner();
$('button').button();
var a = $("#gfg").spinner( "option", { disabled: false,step: 2 } );
console.log(a)
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner option method</h2>
<input id = "gfg" />
</body>
</html>
Output:
Reference: https://api.jqueryui.com/category/widgets/
Similar Reads
jQuery UI Slider option() Method jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI for the webpages. It 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 s
2 min read
jQuery UI Spinner max Option max Option in the jQuery UI slider. The max Option is used to set the maximum value in the jQuery UI spinner. By default, the value is null. Syntax: $( ".selector" ).spinner( { max: number | 'string' } );CDN Link: First, add jQuery UI scripts CDN link, needed for your task. Parameters: This option a
1 min read
jQuery UI Spinner min Option 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 jQueryUI spinner widget helps us to increment and decrement values of the input element using the up and down arrow. In this
2 min read
jQuery UI Spinner pageDown() Method 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 spinner widget helps us to increment and decrement values of input element using up and down arrow. In this article we will
1 min read
jQuery UI Tabs option() Method 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 tabs widget helps us to put some content in different tabs and allow us to switch between them. In this article, we will se
2 min read