Skip to content

Instantly share code, notes, and snippets.

@egulhan
Created July 1, 2014 07:24
Show Gist options
  • Save egulhan/aa4beca148efe4aeeeaf to your computer and use it in GitHub Desktop.
Save egulhan/aa4beca148efe4aeeeaf to your computer and use it in GitHub Desktop.
Encode/decode with/from base64 using jQuery
@source: http://www.naveen.com.au/javascript/jquery/encode-or-decode-html-entities-with-jquery/289
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