Learn how to use the jQuery trim function.
Using the jQuery trim function
If you’re keen to just see the syntax, here’s an example of using the jQuery trim function.
var someText = ' I love trimming strings '; var trimmedText = $.trim(someText); // Gives, 'I love trimming strings'
var someText = ' I love trimming strings '; var trimmedText = someText.trim(); // Gives, 'I love trimming strings'
When to use the jQuery trim function