Let's say I have this HTML element:
<td>—</td>
When analyzed by browsers, it is —converted to the actual em dash, for example:
<td>—</td>
How can I check —without using other characters in my JavaScript code?
console.log(elem.innerHTML == "—"); // false
console.log(elem.textContent == "—"); // false
console.log(elem.innerHTML == "—"); // true
console.log(elem.textContent == "—"); // true
source
share