Javascript String htmlEntities()

Description

Javascript String htmlEntities()


String.prototype.htmlEntities = function() {
  return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

Javascript String htmlEntities()

String.prototype.htmlEntities = function() {
 return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g,
   '&gt;').replace(/'/g, '&#39').replace(/"/g, '&quot');
};



PreviousNext

Related