版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/q463088093/article/details/82585251
在web开发中,有可能出现特殊字符或者转义字符;
比如“π”,“∑”,“λ”等等 数学常量 和 物理常量
在显示过程中可能会出现被转义的情况 变成 “&***”
使用方法:
//text需要被正确显示的字符
function HTMLDecode(text) {
var temp = document.createElement("div");
temp.innerHTML = text;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}