lancehmd
8/1/2012 - 2:21 AM

Simple HTML encoding/decoding using jQuery

Simple HTML encoding/decoding using jQuery

// 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();
}