Latest web development tutorials

jQuery event.namespace property

jQuery Event Methods jQuery Event Methods

Examples

Add and remove custom namespaces:

$ ( "P"). On ( "custom.someNamespace", function (event) {
alert (event.namespace);
});
$ ( "P"). Click (function (event) {
$ (This) .trigger ( "custom.someNamespace");
});
$ ( "Button"). Click (function () {
. $ ( "P") off ( "custom.someNamespace");
});

try it"

Definition and Usage

When an event is triggered, event.namespace property returns a custom namespace.

This attribute can be used according to the plug-OF namespace used in different ways processing tasks.

Tip: For jQuery, the namespace begin with an underscore are reserved.


grammar

event.namespace

参数 描述
event 必需。 event 参数来自事件绑定函数。


Examples s

More examples

Remove the custom of a particular event, click namespace
Remove the custom of a particular event, click the namespace does not remove any other click event handler.


jQuery Event Methods jQuery Event Methods