Here is a quick snippet showing how to add a class to an existing class using jquery. You would use this in a situation where you are unable to modify the actual html in a file or where you may not want to. A great example would be if you want to add a class to a an element that exists through a WordPress plugin. Sure, you could go into the actual plugin folder and add the class but the next time that plugin updates you will lose the class. A better solution is to add the class through your theme using jquery. Here is the snippet:
Replace the “existingclass” with the class that is already assigned and then replace “newclass” with the class you would like to add. This is also interchangeable with an id.