Strips tags from HTML text


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. String.prototype.stripTags = function () {
  2. return this.replace(/<([^>]+)>/g,'');
  3. }
  4.  
  5.  
  6. / Usage:
  7. var tmp = '<a href="htpp://somespammer.com">Some Link</a>';
  8. var safe= tmp.stripTags(); // Returns "Some Link";

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.