Reputation: 96
So I've got a span
<span class="delete-btn">✘</span>
and am trying to include the HTML unicode for x - ✘
within a textNode -
span.appendChild(document.createTextNode("✘"));
however this simply isn't working. Any ideas?
Upvotes: 4
Views: 2082
Reputation: 12880
You can simply use \u2718
:
let span = document.getElementsByClassName('delete-btn')[0];
span.appendChild(document.createTextNode('\u2718'));
<span class="delete-btn">✘</span>
Upvotes: 5