Easy Tutorial
❮ Jquery Plugin Password Validation Jquery Events ❯

jQuery event.namespace Property

jQuery Event Methods

Example

Adding and removing a custom namespace:

$("p").on("custom.someNamespace", function(event){
    alert(event.namespace);
});
$("p").click(function(event){
    $(this).trigger("custom.someNamespace");
}); 
$("button").click(function(){
    $("p").off("custom.someNamespace");
});

Definition and Usage

The event.namespace property returns the custom namespace when the event is triggered.

This property can be used by plugin authors to handle tasks differently based on the namespace used.

Note: For jQuery, namespaces starting with an underscore are reserved.


Syntax

Parameter Description
event Required. The event parameter comes from the event binding function.

More Examples

Removing a custom namespace for a specific click event


jQuery Event Methods

❮ Jquery Plugin Password Validation Jquery Events ❯