Browse - Programming Tips - How can I "trim" (remove whitespace characters from the start and end)

Date: 2011feb14
Language: javaScript

Q.  How can I "trim" (remove whitespace characters from the start and end)
a string with javaScript that works in all browsers?

A.  Firefox has a trim() but IE doesn't so nice solution is to use trim()
in jQuery like this:

str = $.trim(str);
This alone isn't reason enough to use jQuery in a project. Its pretty easy to write a trim using regular expressions.