jQuery - Widget Dialog



Description

The Widget Dialog function can be used with widgets in JqueryUI. Dialog boxes are one of the nice ways of presenting information on an HTML page. A dialog box is a floating window with a title and content area. This window can be moved, resized, and of course, closed using "X" icon by default.

Syntax

Here is the simple syntax to use Dialog −

$( "#dialog" ).dialog();

Example

Following is a simple example showing the usage of Dialog −

<!doctype html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <title>jQuery UI Dialog - 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() {
            $( "#dialog" ).dialog();
         });
      </script>
   </head>
	
   <body>
      <div id = "dialog" title = "Basic dialog">
         <p>This is the default dialog which is useful for displaying
            information. The dialog window can be moved, resized and closed with
            the 'x' icon.</p>
      </div>
 
   </body>
</html>

This will produce following result −

jquery-widgets.htm
Advertisements