What's the best and easy way to add/remove a class to an element which has several classes? I want to do that in pure javascript. I've seen some topics but there was no single solution which everyone agrees to use de-facto. Is there any? Or should I just iterate over all the class, remember them and them add/remove one? Is there more simple and straightforward solution in pure javascript?
Asked
Active
Viewed 494 times
-4
-
have you searched on the web? – gitaarik Jan 02 '17 at 10:22
-
While this *can* be answered in a purely theoretical manner it would be far more useful to you, and others in the future, if you gave a specific snippet of HTML, and the JavaScript you're using to retrieve any given element, for us to demonstrate upon, That way you have a concrete example and we don't have to manufacture one for you. – David Thomas Jan 02 '17 at 10:23
-
@Manish, open your eyes. – ako25 Jan 02 '17 at 10:24