Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jQuery UI - Dialog autoOpen: false</title> <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> <style> body{font-family:Arial, sans-serif; padding:20px;} </style> </head> <body> <h3>Dialog with autoOpen: false</h3> <button id="openBtn">Open Dialog</button> <div id="dialog" title="On-demand dialog" style="display:none;"> <p>This dialog stayed hidden until you clicked the button.</p> </div> <script> $(document).ready(function(){ $("#dialog").dialog({ autoOpen: false }); $("#openBtn").on("click", function(){ $("#dialog").dialog("open"); }); }); </script> </body> </html>
Output