Open In App

jQuery UI Dialog autoOpen Option

Last Updated : 13 Jan, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

AutoOpen option indicates if the dialog box should be automatically open when the page is initially loaded or not. By default, value is true.

Syntax:

$( ".selector" ).dialog({
  autoOpen: false
});

Approach: First, add jQuery UI scripts needed for your project.

<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>

Example 1:

HTML




<!doctype html>
<html lang="en">
  
<head>
    <meta charset="utf-8">
    <link href=
        rel="stylesheet">
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </script>
  
    <script>
        $(function () {
            $("#gfg").dialog({
                autoOpen: true,
            });
            $("#geeks").click(function () {
                $("#gfg").dialog("open");
            });
        });
    </script>
</head>
  
<body>
    <div id="gfg" title="GeeksforGeeks">
        jquery UI| autoOpen dialog option
    </div>
      
    <button id="geeks">Open Dialog</button>
</body>
  
</html>


Output:

Example 2:

HTML




<!doctype html>
<html lang="en">
  
<head>
    <meta charset="utf-8">
    <link href=
        rel="stylesheet">
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </script>
  
    <script>
        $(function () {
            $("#gfg").dialog({
                autoOpen: false,
            });
            $("#geeks").click(function () {
                $("#gfg").dialog("open");
            });
        });
    </script>
</head>
  
<body>
    <div id="gfg" title="GeeksforGeeks">
        Jquery UI| autoOpen dialog option
    </div>
      
    <button id="geeks">Open Dialog</button>
</body>
  
</html>


Output:



Previous Article
Next Article

Similar Reads

jQWidgets jqxWindow autoOpen Property
Introduction: jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxWindow is used for entering data or viewing information in an application. The autoOpen property is used to set or return whether the specified
2 min read
jQWidgets jqxComboBox autoOpen Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful and optimized framework, platform-independent, and widely supported. The jqxComboBox is used to represent a jQuery combobox widget that contains an input field with autocomplete functionality and a list of selectable items displaye
2 min read
jQWidgets jqxLoader autoOpen Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxLoader represents a jQuery widget displaying the inbuilt loader element. The loader can contain icons or text or a combination of icons and text. The loader e
2 min read
jQWidgets jqxDropDownButton autoOpen Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxDropDownButton is used to illustrate a jQuery widget that contains a number of selectable as well as expandable items displayed in the dropdown button. The au
2 min read
jQWidgets jqxNotification autoOpen Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is very powerful, optimized, platform-independent, and widely supported. jqxNotification represents a jQuery widget that can be used to display some notification content to the user. jqxNotification can be modified according to user needs. The autoOp
2 min read
jQWidgets jqxMenu autoOpen Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxMenu represents a jQuery menu widget that is used to create a menu to the website or web application. The jqxMenu widget can be used to create website menus,
2 min read
jQWidgets jqxDropDownList autoOpen Property
Introduction: jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxDropDownList widget is a jQuery drop-down list that contains a list of selectable items displayed in the drop-down list. The autoOpen property i
2 min read
Onsen UI Dialog CSS Component Material Alert Dialog
Onsen UI is an HTML5 framework that allows you to design distinctive and usable user interfaces for free (UI). It also makes UI creation easier, enabling programmers to focus on the core of the product. Onsen UI is a complex set of user interface components designed specifically for mobile apps, with ready-to-use features that follow native iOS and
4 min read
Onsen UI Dialog CSS Component Alert Dialog with Multiple Buttons 2
Onsen UI CSS is used to create beautiful HTML components. It is one of the most efficient ways to create HTML5 hybrid components that are compatible with both mobile and desktop. Alert Dialog is used to display some warning messages with pop-ups on the webpage. Onsen UI Dialog CSS Component Alert Dialog with Multiple Buttons 2 is used to create the
2 min read
Onsen UI Dialog CSS Component Basic Alert Dialog
Onsen UI CSS is used to create beautiful HTML components. It is one of the most efficient ways to create HTML5 hybrid components that are compatible with both mobile and desktop. Alert Dialog is used to display some warning messages with pop-ups on the webpage. Onsen UI Dialog CSS Component Basic Alert Dialog is used to create the basic alert dialo
2 min read