Javascript DOM Event view Property

Introduction

Get the event view:

var x = event.view;

Click the button to get the event view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction(event)">Test</button>

<p id="demo"></p>

<script>
function myFunction(event) {//  www. j av  a 2 s .co  m
  var x = event.view;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The view event property returns a reference to the Window object where the event occurred.




PreviousNext

Related