js里面是没有Trim()这个方法的可以用以下的形式来判断是否输入的值为空

 if (text.value.replace(/\s+/g, "").length == 0)

原文地址:https://www.cnblogs.com/drafire/p/3711562.html