javascript: Trimming form fields
This function simulates the CF Trim( ) function.
Example HTML/CFML code:
Code:
function trim(thisString){
var newString = thisString;
while (newString.charCodeAt(0) < 33)
{
newString = newString.substring(1,newString.length);
}
while (newString.charCodeAt(newString.length - 1) < 33)
{
newString = newString.substring(0, newString.length - 1);
}
return newString;
}