Add/Remove an Event | JavaScriptSource

Add/Remove an Event

Caleb Duke Nov 17, 2006


Use this set of snippets to add or remove events from your scripts. Consists of two functions: addEvent and removeEvent.


  • 'obj' parameter: The object which is the focus of the event to be called.
  • 'type' parameter: The name of the event, e.g., "click" or "submit".
  • 'fn' parameter: Reference to a function that is to be called once the event fires. Requires a parameter.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: addRemoveEvent.js


Paste this code into the HEAD section of your HTML document.

Leave a Response

(1 comment)

helpful script

totaljs Dec 2, 2007