Wednesday, May 11, 2011

javascript trim() not working in IE

Just put the below code in your javascript then check it will cause the trim() to work in IE.

if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}

No comments:

Post a Comment