id like to decode all HTML Entities from a String (named descr, coming from a MySQL-DB)
I use this function to do this:
function htmlDecode(input) {
var doc = new DOMParser().parseFromString(input, "text/html");
return doc.documentElement.textContent;
}
And this works fine, if i print the value to a div.
document.getElementById('ABC').innerHTML = htmlDecode(descr); -> Descr = "&" -> Output in Div "&"
But if i print the value to a textarea its not decoded:
document.getElementById('ABCD').value = htmlDecode(descr); -> Descr = "&" -> Output in Textarea "&"
I spend ours in SO, but didtn find a solution. Can you help me?