Craft Web Design + Development
Brendan McKeown

Hey there. I’m a front-end developer and web designer. I'm all about creating websites and web apps that look and perform flawlessly on any device using HTML, CSS, and Javascript. I enjoy utilizing libraries, frameworks and preprocessors that improve efficiency and reduce confusion.

Check out my resume.

Remove Classes by Prefix

A useful feature of the .removeClass() method is that you can pass it a function, and it will remove the class(es) returned by that function. A good use for this is when you need to remove all classes from an element that begin with a particular string.

    var matches = classes.match(/\bcolor-\S+/ig);
    return (matches) ? matches.join(' ') : '';

Try it on jsFiddle