Endless Tutorial - jQuery - Spinner Component Function

The Widget Spinner function works with widgets in JqueryUI. Spinners provide a quick way to select a value from a set.

Spinner - Syntax

$( "#menu" ).selectmenu();

Spinner - Example

Following is a simple example showing the usage of Spinner −

<!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 the following output -

Spinner component function in jQuery - Wuya Tutorial Network Wuya Tutorial Network provides Widget Spinner function to be used with widgets in JqueryUI. Spinner provides a way to select from a set of... https://www.learnfk.com/jquery/widget-spinner.html

Guess you like

Origin blog.csdn.net/w116858389/article/details/132009702