Javascript examples for DOM HTML Element:Dialog
The open property sets or gets whether a dialog should be open.
This property reflects the <dialog> open attribute.
Set the open property with the following Values
Value | Description |
---|---|
true|false? | Sets whether a dialog window should be open |
A Boolean, returns true if the dialog window is open, otherwise it returns false
The following code shows how to Open a dialog window:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <dialog id="myDialog" open>This is an open dialog window</dialog> <script> function myFunction() {/*from w w w.ja v a 2s . c o m*/ document.getElementById("myDialog").open = true; } </script> </body> </html>