JavaScript Events and Functions

A006JS

JavaScript is often utilized with events. Computer users interact with Web pages by clicking, double-clicking, dragging, and moving the mouse over various parts of the Web page. Your Web page elements can respond to what the user does by using events. In order to respond to the user's actions, you must set up a response to an event. Your page elements (links, documents, and table rows) have events such as:

Once an event is triggered, you will call a function (code snippet) to run your desired code.


buttonOne.addEventListener('click', alertUser);