Created
September 27, 2013 07:20
-
-
Save mschaaf/6725177 to your computer and use it in GitHub Desktop.
html encode/decode with javascript and jquery
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
function decodeHtml(value) { | |
if (value) { | |
return $('<div/>').html(value).text(); | |
} | |
return value; | |
} | |
function encodeHtml(value) { | |
if (value) { | |
return $('<div/>').text(value).html(); | |
} | |
return value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment