String.prototype.trim1=function(){
return this.replace(/(^\s*)|(\s*$)/g,"");
};
Write a function, to clear a space before and after the string (compatible with all browsers)
function trim1(str){
return str.replace(/(^\s*)|(\s*$)/g,"");
}