Javascript: Decode HTML entities
The following function decode HTML entities en return a plain text string:
1 2 3 4 5 6 7 8 |
function entityDecode(strHTML) { var tmpTextArea = document.createElement("textarea"); tmpTextArea.innerHTML = strHTML.replace(/</g,"<").replace(/>/g,">"); var decodedStr = tmpTextArea.value; document.removeElement(tmpTextArea); return decodedStr; } |