$e.removeGroup Function


$e.removeGroup(groupName as string)



The name of the group of events to remove.


Remove all events with the same group name.


When you use the $e.add() command to add events, you can specify an optional 'group' name. This group name is used in the $e.removeGroup() function.

The $e.removeGroup() function allows you to remove events from elements that were initially set up with a 'group' name. This command is useful if you want to remove a large number of events from elements using a single function call.


//Add some validation events to several form controls and assign an arbitrary group name of 'myForm'.

//Now, 'zip' has two event handlers for its 'onblur' event.

//Now, 'zip' has three event handlers for its 'onblur' event. However, this last event 
// handler is not part of the 'myForm' group.
//Now all control have no event handlers attached to the 'onblur' event, except 'zip' 
//which still has 'lookupCity()' as the event handler for the 'onblur' event.
It is important to remove any events that were added to elements before destroying the HTML elements (either through direct DOM manipulation, or by setting the innerHTML of some containing element). For example, assume that your page has a large number of input controls. You use the $e.add() function to bind a validation event handler to the 'onblur' event on all of these controls and you assign a group name.

See Also