Skip to end of metadata
Go to start of metadata

This function attaches an event to an object. For example, you can attach a “click” event to a button. The same can be accomplished by assigning the onclick property on a button; however, with the addEvent() function, you can attach multiple unrelated “click” events to the same object.

Parameters:

  • obj – the object or element to which the event will be applied
  • eventName – the event name. Example: “click”, “mouseover”, etc.
  • func – the event handler function

Examples:

The following code assigns an event to a button.

Alternatively, an anonymous function can be used when assigning the event.

Labels
  • No labels