JQuery的工具trim() what 去掉字符串起始和结尾的空格。 example var str = $.trim(" Do you love me? "); //前后后空格 console.log(str); 控制台打印