jQ UI Selectmenu

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

jQuery UI Progressbar

Progressbar specifies the completion percentage of an operation or progress.

Progressbar can be categorized in two types:

  • Determinate progressbar
  • Indeterminate progressbar

Determinate Progressbar:

Determinate progress bar is only used in situation where the system can accurately update the current status. The determinate progress bar should never fill from left to right, then loop back to empty for a single process.

Indeterminate Progressbar:

The Indeterminate progressbar is used to provide user feedback.

Syntax:

You can use the progressbar() method in two forms:

 
  1. $(selector, context).progressbar (options) Method  
 
  1. $(selector, context).progressbar ("action", params) Method  

First Method

The progressbar (options) method specifies that an HTML element can be managed in the form of a progress bar. Here the "options" parameter is an object that specifies the appearance and behavior of progress bars.

Syntax:

 
  1. $(selector, context).progressbar (options);  

You can use one or more options at a time using JavaScript object. In the case of more than one options, you have to separate them using a comma as follows:

 
  1. $(selector, context).progressbar({option1: value1, option2: value2..... });  

Following is a list of different options that can be used with this method.

Option Description
disabled If you set this option to true then it disables the progress bars. By default its value is false.
max This option is used to set the maximum value for a progress bar. By default its value is 100.
value This option specifies the initial value of the progress bar. By default its value is 0.

Example of jQueryUI Progressbar() method:

Let's take a simple example to demonstrate the functionality of progress bar passing no parameter to the progressbar() method.

 
  1. <!doctype html>  
  2. <html lang="en">  
  3.    <head>  
  4.       <meta charset="utf-8">  
  5.       <title>jQuery UI ProgressBar functionality</title>  
  6.       <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">  
  7.       <script src="http://code.jquery.com/jquery-1.10.2.js"></script>  
  8.       <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>  
  9.       <style>  
  10.          .ui-widget-header {  
  11.             background: blue;  
  12.             border: 1px solid #DDDDDD;  
  13.             color: #333333;  
  14.             font-weight: bold;  
  15.          }  
  16.       </style>  
  17.       <script>  
  18.          $(function() {  
  19.             $( "#progressbar-1" ).progressbar({  
  20.                value: 30  
  21.             });  
  22.          });  
  23.       </script>  
  24.    </head>  
  25.    <body>   
  26.       <div id="progressbar-1"></div>   
  27.    </body>  
  28. </html>