Remove the whitespace from the beginning and end of a string.
$("button").click(function () {
var str = " lots of spaces before and after ";
alert("'" + str + "'");
str = jQuery.trim(str);
alert("'" + str + "' - no longer");
});
No comments:
Post a Comment