Javascript – the event object

When a listener ‘s event occurs, it passes an argument to the function that is associated with the listener. This argument is a reference to the event object which contains some properties. Below is a small list with common properties and methods for all the event types

  • event.type – the type of event occurred (click, moveup etc)
  • event.target – the element that the event occurred to.
  • event.preventDefault() – prevents the execution of the default behaviour of the browser (showing the context menu when right-clicking)
  • event.stopPropagation() – prevents the event listener to be triggered when more than one objects are registered to the same listener.
, <span>Javascript – the event object</span>, KandZ
, <span>Javascript – the event object</span>, KandZ
102220cookie-checkJavascript – the event objectJavascript – the event object

Related posts