JavaScript – IE <=8 does not support trim

// IE <=8 does not support trim().

if (!String.prototype.trim) {

    String.prototype.trim = function() {

        return this.replace(/^\s+|\s+$/g, );

    };

}