Skip to content

Instantly share code, notes, and snippets.

@loickreitmann
Created April 22, 2011 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loickreitmann/937389 to your computer and use it in GitHub Desktop.
Save loickreitmann/937389 to your computer and use it in GitHub Desktop.
String function to remove HTML tags from the string
/**
* stripTags: removes HTML tags from a string
* @return String
*/
String.prototype.stripTags = function () {
return this.replace(/<[^<>]+>/g, ' ').replace(/\s{2,}/g, ' ');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment