Skip to content

Instantly share code, notes, and snippets.

@crtr0
Created December 3, 2012 20:56
Show Gist options
  • Save crtr0/4197962 to your computer and use it in GitHub Desktop.
Save crtr0/4197962 to your computer and use it in GitHub Desktop.
Monkey patch for unescaping HTML in a String
String.prototype.unescapeHtml = function () {
var temp = document.createElement("div");
temp.innerHTML = this;
var result = temp.childNodes[0].nodeValue;
temp.removeChild(temp.firstChild);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment