💊 If I do document.getElementById('test').innerHTML.charAt(0) I get � back. Is ther" /> 💊 If I do document.getElementById('test').innerHTML.charAt(0) I get � back. Is ther" /> 💊 If I do document.getElementById('test').innerHTML.charAt(0) I get � back. Is ther"/>

charAt() on HTML entities

15 views Asked by At

Say I have the following HTML code:

<span id="test">&#128138;</span>

If I do document.getElementById('test').innerHTML.charAt(0) I get � back. Is there a way to get the actual glyph back?

Here's a JS fiddle showing the code in action:

https://jsfiddle.net/mLznfxr7/

0

There are 0 answers