DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

John has posted 18 posts at DZone. View Full User Profile

Striphtml Prototype Function

10.30.2008
| 3380 views |
  • submit to reddit
        striphtml prototype function

usage: $('elem').innerHTML.stripHTML();

String.prototype.stripHTML = function() {
    var matchTag = /<(?:.|\s)*?>/g;
    return this.replace(matchTag, "");
};