JavaScript Events

DOM (Document Object Model):

The Document Object Model (DOM) is a programming API for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

JavaScript Events:

Events are a part of the Document Object Model (DOM). Every HTML page contains a set of events associated with tags/elements. JavaScript has ability to deal with those events.
Here are few examples of events:

  • When the user clicks a button
  • Whenever the webpage loads
  • Whenever pressing any key
  • closing a window
  • Mouse Over html elements

There are many more events. When these events occurs in html page, JavaScript can interact with them and perform some action.

Using a simple example, we will call a JavaScript function when user click on button.

Congratulations! Chapter Finished. Do you want to practice more?
Exercises & Assignments
  • No Content Found.
  • Interview FAQs
  • No Content Found.