Is it possible to get the name of HTML-Special-Characters programmatically in JavaScript? Per example something like here:
function HtmlEncode(s)
{
var el = document.createElement("div");
el.innerText = el.textContent = s;
s = el.innerHTML;
return s;
}
Test run:
alert(HtmlEncode('&;\'><"'));
Output:
&;'><"
But the function of @Cerebrus (see link above) doesn't work always.
alert(HtmlEncode('$§©'));
Per example it fails for following characters:
$ : $
& : &
§ : §
© : ©
...
Any idea, how can I get the name of HTML Special Characters?
(I mean programmatically like above, but no list-name like a map).
Thanks in advance