Javascript String sanitize()
String.prototype.sanitize = function(){ return this.replace(/</g, '<').replace(/>/g, '>'); }
String.prototype.sanitize = function() { return $('<div/>').text(this).html(); };
String.prototype.sanitize = function() { return this/* w w w. j a v a2 s .c o m*/ .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, ''') }