List of utility methods to do HTML Unescape
unescape()String.prototype.unescape = function() { return unescape(this).replace(/[-_]/g, ' '); | |
unescapeEntities()String.prototype.unescapeEntities = function() { return this.replace(/&#([0-9]{1,4});/gi, function(match, numStr) { var num = parseInt(numStr, 10); return String.fromCharCode(num); }); }; | |
unescapeHTML()String.prototype.unescapeHTML = function() { return String(this).replace("&", "&").replace("<", "<").replace(">", ">").replace('"', '"').replace(''', "'").replace('/', "/"); | |
unescapeHtml()String.prototype.unescapeHtml = function () { var temp = document.createElement("div"); temp.innerHTML = this; var result = temp.childNodes.length === 0 ? "" : temp.childNodes[0].nodeValue; if(temp.firstChild) temp.removeChild(temp.firstChild); return result; }; | |
unescapeHtml()String.prototype.unescapeHtml = function () { var temp = document.createElement("div"); temp.innerHTML = this; var result = ""; for (var i = 0; i < temp.childNodes.length; i++) { result = result + temp.childNodes[i].nodeValue; temp.removeChild(temp.firstChild) return result; ... | |
unescapeHtml()String.prototype.unescapeHtml = function () { var temp = document.createElement("div"); temp.innerHTML = this; var result = temp.childNodes.length === 0 ? "" : temp.childNodes[0].nodeValue; if(temp.firstChild) temp.removeChild(temp.firstChild); return result; }; | |
unescapeHtml()String.prototype.unescapeHtml = function () { var temp = document.createElement("div"); temp.innerHTML = this; var result = temp.childNodes[0].nodeValue; temp.removeChild(temp.firstChild); return result; | |
unescapeHtmlEntities()String.prototype.unescapeHtmlEntities = function () { try{ var temp = document.createElement('textarea'); temp.innerHTML = this; return temp.value; }catch(e){ return this; | |
unescapeHtmlEntities()String.prototype.unescapeHtmlEntities = function () { try{ var temp = document.createElement('textarea'); temp.innerHTML = this; return temp.value; }catch(e){ return this; |