The window event property returns the event which is currently being handled by the site’s code in the current window.
Syntax:
event = window.event;
Return Value: This property returns the event object currently being handled.
Example: In this example, we will get the event type using this property.
<!DOCTYPE HTML> <html> <head> <title>window event property</title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <p> HTML | window event property </p> <button onclick = "Geeks()"> Click Here </button> <p id="a"> </p> <script> var a = document.getElementById("a"); function Geeks() { console.log(window.event) a.innerHTML="Event type is : "+window.event.type; } </script> </body> </html> |
chevron_right
filter_none
Output:
Before Clicking Button:
After Clicking Button:
In Console, the event object is:
Supported Browsers:
- Google Chrome
- Edge
- Firefox
- Safari
- Opera
- Internet Explorer
Recommended Posts:
- HTML | Window self( ) Property
- HTML | Window name Property
- HTML | Window top( ) Property
- HTML | Window innerWidth Property
- HTML | Window innerHeight Property
- HTML | DOM Window closed Property
- HTML | Window length Property
- HTML | Window outerWidth Property
- HTML DOM window crypto property
- HTML | Window pageYOffset Property
- HTML | Window pageXOffset Property
- HTML | Window outerHeight Property
- HTML DOM Window navigator Property
- HTML DOM Window scrollMaxY Property
- HTML DOM Window scrollX property
- HTML DOM Window.location Property
- HTML DOM Window origin Property
- HTML DOM Window speechSynthesis property
- HTML DOM Window visualViewport property
- HTML | Window sessionStorage( ) Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


