olcluw
Last Updated: February 25, 2016
·
619
· zaus

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('#', ''))
            ;
});