You know about the JavaScript trim()
function, right? Or the jQuery $.trim()
function?
trim()
:
The
trim()
method removes whitespace from both ends of the string.
Usage:
$("#Validate").click(function () {
$('#address').val(function() { return this.value.trim(); });
});
$.trim()
:
Description: Remove the whitespace from the beginning and end of a string.
Usage:
$("#Validate").click(function () {
$('#address').val(function() { return $.trim($(this).val()); });
});