Dialog showModal() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Dialog

Description

The showModal() method shows the dialog and prevents user from interacting with other elements on the page.

Show a model dialog window

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Show dialog</button>

<dialog id="myDialog">This is a dialog window</dialog>

<script>
function myFunction() {/*from  w w w  .j  a  va 2s .c o  m*/
    document.getElementById("myDialog").showModal();
}
</script>

</body>
</html>

Related Tutorials