-
-
Save miqueiaspenha/2f42af00627bfc93902016cfc5aa9788 to your computer and use it in GitHub Desktop.
Simple HTML encoding/decoding using 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
// http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding | |
function htmlEncode(value){ | |
return $('<div/>').text(value).html(); | |
} | |
function htmlDecode(value){ | |
return $('<div/>').html(value).text(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment