Created
April 18, 2012 06:20
-
-
Save ardydedase/2411431 to your computer and use it in GitHub Desktop.
JavaScript: jQuery HTML Decoder/Encoder
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 htmlEncode(value){ | |
if (value) { | |
return jQuery('<div />').text(value).html(); | |
} else { | |
return ''; | |
} | |
} | |
function htmlDecode(value) { | |
if (value) { | |
return $('<div />').html(value).text(); | |
} else { | |
return ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment