Skip to content Skip to sidebar Skip to footer

Can't Get If ... Else Statement To Properly Switch While Using Special Characters ("⏶/⏷")

In short I'm using special characters for a part of my website, and can't figure out how to express them in a JavaScript if ... else statement, which currently evaluates the if to

Solution 1:

Or you can do it with CSS class and not rely on the text

function funcAbout() {
    var btn = document.getElementById("undernavbtn");
    btn.classList.toggle("active")
}
#undernavbtn span::after {
  content: " \25B2"; 
}

#undernavbtn.active span::after {
  content: " \25BC"; 
}
<div id="undernav">
    <button type="button" id="undernavbtn" onclick="funcAbout()"> <span>About</span></button>
</div>

Post a Comment for "Can't Get If ... Else Statement To Properly Switch While Using Special Characters ("⏶/⏷")"