What are browser events?

An event refers to an action or occurrence that happens in the system you are programming. The system then notifies you about the event so that you can respond to it in some way if necessary.

In this article, I will focus on events in the context of web browsers. Essentially, an event is an indicator which shows that a certain action has taken place so that you can make an appropriate response.

To illustrate what I am talking about, let’s imagine that you are standing at a pedestrian crossing waiting for traffic lights to change so that you can safely cross the road. The event is the change in traffic light which makes you subsequently take an action – which, in this case, is crossing the road.

Similarly in web development, we can take an action whenever an event we have interest in takes place.

Some of the common events you might have come across in web development include:

  1. Mouse events
  • click
  • dblclick
  • mousemove
  • mouseover
  • mousewheel
  • mouseout
  • contextmenu
  • mousedown
  • mouseup

2. Touch events

  • touchstart
  • touchmove
  • touchend
  • touchcancel

3. Keyboard events

  • keydown
  • keypress
  • keyup

4. Form events

  • focus
  • blur
  • change
  • submit

5. Window events

  • scroll
  • resize
  • hashchange
  • load
  • unload

For a complete list of events and the different categories they fall into, you can check out the MDN documentation. Some of the events listed are standard events in official specifications, while others are events used internally by specific browsers.

#javascript #web-development #developer #programming

Browser Events Explained
1.85 GEEK