var reg = /\s*/g;
$('.modal-content').find('input').focusout(function () { if ($(this).val() == '' || reg.test($(this).value)) {
$(this).css('backgroundColor','#FFEFEF');
$(this).nextAll('.hintWrap').css('display','block'); console.log(reg.test($(this).value));
} else {
$(this).css('backgroundColor','#F5F5F5');
$(this).nextAll('.hintWrap').css('display','none'); console.log(reg.test($(this).value));
}
})谢谢!
1 回答

宝慕林4294392
TA贡献2021条经验 获得超8个赞
/s*/g能匹配成功任意字符,(包括空串。个数随意,没有也行).因为所有的都能包含""。
评论区转码了,写这了
多个空格啊?>=2个?/\s\s+/g; ^&写不写你看着来,没太明白你的意思。
添加回答
举报
0/150
提交
取消