Sign in

.unwatch()

De-register an event handler that was previously registered with .watch().

Syntax

neon.unwatch(string eventname, function callback)

eventname

The name of the event that was being watched.

This name should not include an "on" prefix.

callback

The function that was previously registered.

Requirements

This method should be executed on a selection of elements. Please see the .select() method.

Return value

This method is chainable. It returns a copy of the Neon object on which it was called.

Description

This method removes an event handler registration that was previously set up with a similar call to .watch().

It is important that both parameters - the event name and the callback function - are identical to those provided to .watch(). The function must be the same function, and not just a function with the same name or behaviour.

It is not necessary to call .unwatch() on the same set of elements as the call to .watch(), as long as all the elements in the call to .unwatch() did have the event registered.

Events which are registered with .watch() should be de-registered with .unwatch(). It is not likely to work properly if an event is registered with watch() and de-registered with the W3C or Microsoft event handling functions, or vice-versa, although it is safe to have separate event handlers use those functions on the same page.