Skip to content

Instantly share code, notes, and snippets.

Avatar

minyoad minyoad

View GitHub Profile
@jmblog
jmblog / gist:3222899
Created Aug 1, 2012
Simple HTML encoding/decoding using jQuery
View gist:3222899
// 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();
}