Created
December 3, 2012 20:56
-
-
Save crtr0/4197962 to your computer and use it in GitHub Desktop.
Monkey patch for unescaping HTML in a String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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