jQuery - Widget Slider



Description

The Widget Slider function can be used with widgets in JqueryUI.The slider is horizontal and has a single handle that can be moved with the mouse or by using the arrow keys.

Syntax

Here is the simple syntax to use Slider −

$("#slider").slider();

Example

Following is a simple example showing the usage of Slider −

<!doctype html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <title>jQuery UI Slider - Default functionality</title>
		
      <link rel = "stylesheet" 
         href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
			
      <script type = "text/javascript" 
         src = "https://www.tutorialspoint.com/jquery/jquery-3.6.0.js">
      </script>
		
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
      </script>

      <script>
         $(function() {
            $( "#slider" ).slider();
         });
      </script>
   </head>

   <body>
      <div id = "slider"></div>
   </body>
</html>

This will produce following result −

jquery-widgets.htm
Advertisements