Say, you have opened gmail, entered your userId and Password and clicked on submit. And bingo, you are in your inbox checking mail.
Or you have clicked any button in a website and a popup window opens.
So, after clicking the buttons, some action happens. These are called events in JavaScript.
Let us quickly jump into a practical example.
<html> <body> <button onclick="testFunction()">Click ME</button> <script> function testFunction() { alert("Window popped up on click") } </script> </body> </html>
So, in the above example, we have created a button and named it Click ME.
<button onclick="testFunction()">Click ME</button>
Now, if you see the button. It has an attribute called onclick, which calls a JavaScript Function called testFunction().
<script> function testFunction() { alert("Window popped up on click") } </script>
Now this attribute onclick of button triggers an event.
In other words, some action gets triggered onclick and that is called Event.
Some of the popular Events are :