Pra*_*ana 23
另一个好帖子:更快的JavaScript修剪
您只需要应用trim函数并检查字符串的长度.如果修剪后的长度为0 - 则字符串仅包含空格.
var str = "data abc";
if((jQuery.trim( str )).length==0)
alert("only spaces");
else
alert("contains other characters");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20871 次 |
| 最近记录: |