PDA

View Full Version : Stripping HTML from a string.


Majoracle
04-04-2007, 09:12 PM
I'm pretty sure this is possible with the replace() function somehow, I just don't know how. sort of like:

function removeHTMLTags(str) {
text = str.replace();
return text;
}

Any way to do this? Thanks.

Mr J
04-04-2007, 10:33 PM
Not really good with regExp but give this a try

function removeHTMLTags(str) {

re = new RegExp("<[^>]*>","g");
text = str.replace(re," ");
return text;

}