

To remove all delegated events from an element without removing non-delegated events, use the special value "**".Ī handler can also be removed by specifying the function name in the handler argument. on() when the event handler was attached. The selector string must exactly match the one passed to. To remove specific delegated event handlers, provide a selector argument. At minimum, either a namespace or event name must be provided. All events of all types in a specific namespace can be removed from an element by providing just a namespace, such as ".myPlugin".

#Smoothscroll in jquery 1.4.4 code#
When writing code that will be used as a plugin, or simply when working with a large code base, best practice is to attach and remove events using namespaces so that the code will not inadvertently remove event handlers attached by other code. If a simple event name such as "click" is provided, all events of that type (both direct and delegated) are removed from the elements in the jQuery set. When multiple filtering arguments are given, all of the arguments provided must match for the event handler to be removed. Specific event handlers can be removed on elements by providing combinations of event names, namespaces, selectors, or handler function names. off() with no arguments removes all handlers attached to the elements. See the discussion of delegated and directly bound events on that page for more information. off() method removes event handlers that were attached with.
