jquery.removeClassWhere plugin
The missing jQuery function to easily remove classes matching a filter -- combines $el.removeClass
and $.grep
.
https://gist.github.com/zaus/5221271
Example:
$links.click(function() {
$container
.removeClassWith('has-')
.addClass('has-' + $(this).attr('href').replace('#', ''))
;
});
Written by Jeremy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Plugin
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#