jQuery - Widget Spinner
Advertisements
Description
The Widget Spinner function can be used with widgets in JqueryUI.Spinner provide a quick way to select one value from a set.
Syntax
Here is the simple syntax to use Spinner −
$( "#menu" ).selectmenu();
Example
Following is a simple example showing the usage of Spinner −
Live Demo<!doctype html> <html lang = "en"> <head> <meta charset = "utf-8"> <title>jQuery UI Spinner - Default functionality</title> <link rel = "stylesheet" href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src = "//code.jquery.com/jquery-1.10.2.js"> </script> <script src = "/resources/demos/external/jquery-mousewheel/jquery.mousewheel.js"> </script> <script src = "//code.jquery.com/ui/1.11.4/jquery-ui.js"> </script> <script> $(function() { var spinner = $( "#spinner" ).spinner(); $( "#disable" ).click(function() { if ( spinner.spinner( "option", "disabled" ) ) { spinner.spinner( "enable" ); } else { spinner.spinner( "disable" ); } }); $( "#destroy" ).click(function() { if ( spinner.spinner( "instance" ) ) { spinner.spinner( "destroy" ); } else { spinner.spinner(); } }); $( "#getvalue" ).click(function() { alert( spinner.spinner( "value" ) ); }); $( "#setvalue" ).click(function() { spinner.spinner( "value", 5 ); }); $( "button" ).button(); }); </script> </head> <body> <p> <label for = "spinner">Select a value:</label> <input id = "spinner" name = "value"> </p> </body> </html>
This will produce following result −
jquery-widgets.htm
Advertisements