How do i unescape HTML Entities in JS? (change < to <)
html, javascript
Solution
Create a div, set it's `innerHTML` and then read `innerText`
var d = document.createElement("div");
d.innerHTML = "<html xmlns="http://www.w3.org/1999/xhtml" >";
alert(d.innerText || d.text || d.textContent);
Problem
How do i unescape HTML Entities in JS? When googling i literally saw answers with a huge switch and people rolling their own. I'd like the string `<html xmlns="http://www.w3.org/1999/xhtml" >` to become `<html xmlns="http://www.w3.org/1999/xhtml" >`