Created
May 17, 2012 20:38
-
-
Save 6ui11em/2721459 to your computer and use it in GitHub Desktop.
jQuery: encode / decode HTML Entites
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
// Encode/decode htmlentities | |
function encodeEntities(s){ | |
return $("<div/>").text(s).html(); | |
} | |
function dencodeEntities(s){ | |
return $("<div/>").html(s).text(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment