Description: Remove the whitespace from the beginning and end of a string.
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button>Show Trim Example</button>
<script>
$("button").click(function () {
var str = " lots of spaces before and after ";
alert("'" + str + "'");
str = jQuery.trim(str);
alert("'" + str + "' - no longer");
});
</script>
</body>
</html>
$.trim(" hello, how are you? ");
"hello, how are you?"