Posted By

cochambre on 08/02/06


Tagged

html strip String tags remove clean


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

nicolaspar
nutella
vali29


Strip HTML tags from string


 / Published in: JavaScript
 

  1. function stripHtml(s) {
  2. return s.replace(/\\&/g, '&amp;').replace(/\\</g, '&lt;').replace(/\\>/g, '&gt;').replace(/\\t/g, '&nbsp;&nbsp;&nbsp;').replace(/\\n/g, '<br />');
  3. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: poyekars on April 29, 2009

It is not working.

You need to login to post a comment.