Browse - programming tips - javascript trim for all browsersDate: 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.
Add a commentSign in to add a comment | Advertisements:
|