Javascript DOM HTML Dialog open Property get

Introduction

Find out if a dialog window is open or not:

var x = document.getElementById("myDialog").open;

Click the button to find out if the dialog window is open.

View in separate 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 ww .jav  a 2 s . c o m
  var x = document.getElementById("myDialog").open;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related