Wednesday 27 January 2010

jQuery.trim()

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