Combining jQuery’s addClass() + removeClass() attributes

A few times I’ve been in a situation where I’ve been working on a web application, or creating some custom form validation and for whatever reason I’ve needed to add and remove multiple CSS classes from a selector. Obviously jQuery has .addClass() and .removeClass() methods, both of which are invaluable in pretty much any jQuery project, but as a person who likes to keep code as concise as possible I still found it a little frustrating that I was having to add both attributes every time.
Continue Reading