Events can be namespaced in jquery so that triggering and unbinding them can done in an easier manner. Generally , if we bind an event handler to a specific event , we would do it as under:-
In this case , if we unbind the click event using
$(selector).unbind(“click”), the particular event would be unbound from all controls having the particular selector.
However, if we use namespace while binding events , we can unbind and trigger the events associated with the namespace and ensure that controls having same events bound with different namespace are not affected.
Following is the code snippet :-
$(‘.class’).trigger(‘click.namespace’); // Will trigger
$(‘.class’).trigger(‘click’); // Will trigger
$(‘.class’).trigger(‘click.other’); // Won’t trigger