Posted By

enchance on 09/06/09


Tagged

strip text remove links


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Nanobyte


Strips tags from HTML text


 / Published in: JavaScript
 

  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  

You need to login to post a comment.