console.log(document.getElementById('wsk').textContent === "CASE ");
console.log(document.getElementById('wsk').textContent === "CASE ");
<span id="wsk">CASE </span>
Why are the above log both output false? How should I write the value in 3rd and 4th line so it can evaluates to true?
And by the way, on my page if I replace the "$nbsp;" in the span with a real space, it won't get displayed, why?
A non-breaking space (0xA0) is not a normal space (0x20)
Try comparing the actual character:
document.getElementById('wsk').textContent === 'CASE\xA0'
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