November 18, 2013 06:11 pm GMT
Original Link: http://css-tricks.com/namespaced-events-jquery/
Namespaced Events in jQuery
It's really easy to add an event listener in jQuery. It's equally easy to remove an event listener. You might want to remove a listener because you don't care to perform any actions on that event anymore, to reduce memory usage, or both. But let's say you've attached several listeners to the same event. How do you remove just one of them? Namespacing can help.
Let's look at code.
$("#element") .on("click", doSomething) .on("click", doSomethingElse);
Both doSomething
and doSomethingElse
will fire …
Namespaced Events in jQuery is a post from CSS-Tricks
Original Link: http://css-tricks.com/namespaced-events-jquery/
Share this article:
Tweet
View Full Article