Tuesday, June 28, 2011

JavaScript trim() function not working in FF or IE

Copy the code given below in your java script tag and get the trim() function working

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

No comments:

Post a Comment