jQuery provides a way to encode and decode html entities.
If you use a "
" tag, it will strip out all the html.
function htmlDecode(value) {
return $("").html(value).text();
}
function htmlEncode(value) {
return $('').text(value).html();
}
If you use a "" tag, it will preserve the html tags.
function htmlDecode(value) {
return $("").html(value).text();
}
function htmlEncode(value) {
return $('').text(value).html();
}