jQuery - Widget Dialog


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.


Here is the simple syntax to use Dialog −

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


Following is a simple example showing the usage of Dialog −

<!doctype html>
<html lang = "en">
      <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 type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
         $(function() {
            $( "#dialog" ).dialog();
      <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>

This will produce following result −

Kickstart Your Career

Get certified by completing the course

Get Started