Skip to content

Instantly share code, notes, and snippets.

@rafaellyra
Created March 17, 2013 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaellyra/5180749 to your computer and use it in GitHub Desktop.
Save rafaellyra/5180749 to your computer and use it in GitHub Desktop.
Extensão do trim() para navegadores que não possuem esse método javascript nativo.
if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment