Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Created May 17, 2012 20:38
Show Gist options
  • Save 6ui11em/2721459 to your computer and use it in GitHub Desktop.
Save 6ui11em/2721459 to your computer and use it in GitHub Desktop.
jQuery: encode / decode HTML Entites
// 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