The question says it all; JS doesn\'t seem to have a native trim() method.
The shortest form for jQuery:
string = $.trim(string);
Link