The question says it all; JS doesn\'t seem to have a native trim() method.
I use this.
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); }