Get Dialog Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Dialog

Introduction

The Dialog object represents an HTML <dialog> element.

You can access a <dialog> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">open the dialog window</button>

<dialog id="myDialog">This is an open dialog window</dialog>

<script>
function myFunction() {//  ww  w.  j a va  2 s  .  c o  m
    var x = document.getElementById("myDialog");
    x.open = true;
}
</script>

</body>
</html>

Related Tutorials