Home › Forums › JavaScript › how to change class of an element by click › Reply To: how to change class of an element by click
November 2, 2016 at 2:35 pm
#247339
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.