How can assign multiple css classes to an html element through javascript without using any libraries?
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
|
|
|||
|
guaranteed to work on new browsers. the old className way may not, since it's deprecated.
|
||||
|
Perhaps:
Not tested, but should work. |
|||
|
Try this:
Similar logic could be used to make a removeClass function. |
|||
|
just use this
take care about Space to avoid mix old class with new class |
||||
|