Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how to change class of an element by click Reply To: how to change class of an element by click

#247339
Shikkediel
Participant

It does actually trigger these multiple classes but because they have the same property (background), the last one in the style overrides any previous classes. You’ll notice it turns blue if you switch heir places in the order of the css. So if you add several classes with different properties, they’ll all apply (and toggle). On the other hand, using the current JS it’s not possible the influence the order of the classes applied – the style itself is determining it.