Click here to Skip to main content
15,915,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I select an element with multiple classes?
$('#nav').find('.open').removeClass('open'); $('#nav').find('.current').removeClass('current');

better way for doing this???

What I have tried:

$('#nav').find('.open').removeClass('open'); $('#nav').find('.current').removeClass('current');
Posted
Updated 22-May-16 1:21am
Comments
Karthik_Mahalingam 22-May-16 6:00am    
what is the issue ?

1 solution

You have two options depending on what you want...
If you want to remove a few particular classes from all the elements have it, you should use a code like this:
JavaScript
$('.open, .current, .more, .andmore').removeClass('.open .current .more .andmore');

If you want to clear all classes for elements with one of the specified class, do something like this:
JavaScript
$('.open, .current, .more, .andmore').removeClass();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900