jquery怎么判断字符串是否有空格?

2025-03-12 15:34:22
推荐回答(1个)
回答1:

jQuery有trim函数
$.trim(字符串);

可以使用js的indexOf函数判断是否有空格

if(str.indexOf(" ")!=-1){

}