我检查输入标签是空的。如果用户尝试只输入空格,它应该得到警报。但是当我输入一些文本时它给出相同的警报帮助我 [英] Am checking for input tag is empty.and if user try to enter only whitespaces it should get alert.but when I enter some text it giving same alert help me
本文介绍了我检查输入标签是空的。如果用户尝试只输入空格,它应该得到警报。但是当我输入一些文本时它给出相同的警报帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Am checking for input tag is empty.and if user try to enter only whitespaces it should get alert.but when i enter some text it giving same alert help me
我尝试了什么:
if(!$。trim($(#inputid)。val())|| $(#inputid)。val()==)
alert(输入不应为空);
返回false;
What I have tried:
if(!$.trim($("#inputid").val())|| $("#inputid").val()=="" )
alert("input should not be empty");
return false;
推荐答案
.trim(
(#inputid)。val())||
("#inputid").val())||
(#inputid)。val()==)
alert(输入不应为空);
返回false;
("#inputid").val()=="" )
alert("input should not be empty");
return false;
这篇关于我检查输入标签是空的。如果用户尝试只输入空格,它应该得到警报。但是当我输入一些文本时它给出相同的警报帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文