Javascript String trimRight()
trimRight()
String.prototype.trimRight = function() { return this.replace(/(\s*$)/g, ""); }
String.prototype.trimRight = String.prototype.trimRight || function() { return this.replace(/\s+$/,''); };