What are events? Where they are used. 

Question :

What are events? Where they are used. 

When the user manipulates a page events may be occurred. Events are fired inside the browser window, and tend to be attached to a specific item that resides in it which may be a single element, set of elements, the HTML document loaded in the current tab, or the entire browser window. JavaScript's interaction with HTML is handled through events. Events are occurred whenever a page is loaded (page load event), the user clicks a button (button click event) or events are occurred on pressing any key, closing a window, resizing a window, etc. Some more types of events may occur on:

  • hovering the cursor over a certain element.
  • web page finishing loading.
  • A form being submitted.
  • A video being played, or paused, or finishing play.
  • An error occurring. 

The occurrence of these events may be used by the Programmers and to execute responses coded in JavaScript like cause buttons to close windows, messages to be displayed to users, data to be validated, or any other type of response.

Events are a part of the DOM (Document Object Model) Level 3 and every HTML element contains a set of events which may trigger a block of JavaScript Code written for that specific purpose, i.e. JavaScript can "react" on these events and allows executing the code when events are detected.

The most common Events are

onchange - An HTML element has been changed

onclick - The user clicks an HTML element (button, image etc)

onmouseover - The user moves the mouse over an HTML element

onmouseout - The user moves the mouse away from an HTML element

onkeydown - The user pushes a keyboard key

onload - The browser has finished loading the page  

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad