Events

In javascript you can interact with users by creating and executing events.

Events are triggered in the browser when something happens such as mouse click or movement and keyboard interaction.

load is an event that fires when a page is first loaded.

click is another event, which happens when a user clicks something.

These events need to be attached to DOM elements to be executed. For example to execute a function when a link(hyperlink) is clicked, the event click should be attached to the link

Steps to implement events.
  1. Get a DOM node.
  2. Attach an event to it.
  3. Execute a specific function when the event is triggered.

This model referred to as event-driven JavaScript.

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +