Last active
February 10, 2016 10:55
-
-
Save jgarciaruiz/6d91aba3e574e361d01b to your computer and use it in GitHub Desktop.
Remove leading and trailing white spaces from html string. [Polyfill]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// http://stackoverflow.com/questions/10032024/how-to-remove-leading-and-trailing-white-spaces-from-a-given-html-string | |
//Running the following code before any other code will create trim() if it's not natively available. | |
if(!String.prototype.trim) { | |
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