Strip html tags with javascript   Leave a comment

var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");
or
jQuery.fn.stripTags = function() {
        return this.replaceWith( this.html().replace(/<\/?[^>]+>/gi, '') );
};

or
var html_stripped = html.replace(/(<.*?>)/ig,"");

Posted 2011年08月10日 by gw8310 in javascript

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: