Events
Introduction
We can execute javascript code on the occurrence of an event. For Ex: When a user clicks on the Button the Javascript code should be executed so Here, User Click is an Event
There are many more Events:
- When a user clicks the mouse
- When a web page has loaded
- When an image has been loaded
- When the mouse moves over an element
- When an input field is changed
- When an HTML form is submitted
- When a user strokes a key
How to Execute Code on Event Occur
Syntax
Example
Here,
When a user clicks on the Paragraph i.e. "Hello Guys!!!" Its text gets changed to "Welcome to the World of JS"
Let's Go Deep into Events.
Events List