I need to change a tag on my html if another tag on my dom is missing a class, I need to check it with out using JS or Jquery, can I do that?
Example:
<a class="collapsed">MY TEXT HERE IS RED</a>
after clicking on this tag the class - > collapsed disappear and I need my text to change to green. the only change in my code is the collapsed been disappeared so according to that I need to change my text color I need the hasClass function in css...
Why not simply use :not() selector like this :
a:not(.collapsed) {
color: green;
}
a.other {
color:red;
}
<a class="collapsed">MY TEXT HERE IS RED</a>
<a>MY TEXT HERE IS green</a>
<a class="other">MY TEXT HERE IS RED</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With