Javascript Code to Strip HTML tags from string
1: function StripHTMLAndTrim(text)
2: {
3: var htmlStriper = /<(?:.|\s)*?>/g;
4: text = text.replace(htmlStriper, " ");
5: while (text.indexOf(" ") >= 0)
6: {
7: text = text.replace(" ", " ");
8: }
9: return text.replace(/^\s+|\s+$/g, "");
10: }
0 comments
Posts a comment