•  tutorial
Edit

 Tutorial

Remove a class if element has it otherwise add the class

See the Pen JQuery Remove a class if element has it otherwise add the class by inimist (@inimistschool)on CodePen.