Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 18, 2013 06:11 pm GMT

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:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks