jQuery UI Spinner value() Method
Last Updated :
24 May, 2022
jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. jQuery UI spinner widget helps us to increment and decrement values of an input element using up and down arrows.
In this article, we will see how to use the value() method in the jQuery UI spinner. This method returns the current value as a number. The returned value is parsed on the basis of numberFormat and culture options.
Syntax 1:
var value = $(".selector").spinner( "value" );
Parameters: This method does not accept any parameters.
Return Value: This method returns a parsed value on the basis of numberFormat and culture options.
Syntax 2:
$(".selector").spinner( "value", 50 );
Parameters: This method accepts a single parameter value of Number or String type.
CDN Link: First, add jQuery UI scripts needed for your project.
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Example: This example describes the jQuery UI Spinner value() method.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> jQuery UI Spinner value() Method </title>
<link rel="stylesheet" href=
"//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src=
"//code.jquery.com/jquery-1.12.4.js">
</script>
<script src=
"//code.jquery.com/ui/1.12.1/jquery-ui.js">
</script>
<style>
h1 {
color: green;
}
#divID {
width: 600px;
}
</style>
</head>
<body>
<center>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI Spinner value() Method</h2>
<input id="divID">
<br><br>
<input type="button" id="btn"
value="Spinner Value"
style="padding: 5px 15px;">
</center>
<script>
$(function () {
$("#divID").spinner();
$("#btn").on('click', function() {
var val = $("#divID").spinner("value");
alert("Spiner Value: " + val);
});
});
</script>
</body>
</html>
Output:
Reference: https://api.jqueryui.com/spinner/#method-value
Similar Reads
jQuery UI Slider value() Method 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 provides us a slider control through the slider widget. Slider helps us to get a certain value using a given range.
2 min read
jQuery UI Spinner widget() 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 Spinner stepUp() Method 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 an input element using up and down arrow. In this artic
2 min read
jQuery UI Progressbar value() Method jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Progressbar widget is used to add display the status of a determinate or indeterminate process. The jQuery UI progressb
2 min read
jQuery UI Spinner 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 spinner widget helps us to increment and decrement values of input element using up and down arrow. In this article, we wil
2 min read