String.prototype.trim = function() {
// skip leading and trailing whitespace
// and return everything in between
var trimmedString = this
trimmedString = trimmedString.replace(/^\s+/,"");
trimmedString = trimmedString.replace(/\s+$/,"");
return trimmedString;
}
//using:
var trimmed_str=field_name.value.trim();
No comments:
Post a Comment