开发者

Why doesn't this JavaScript evaluation work?

I only want to execure a cerat开发者_StackOverflow中文版in code IF three input fields do not have empty values. So why doesn't this code work:

if($("#field1").val() != "" && $("#field2").val() != "" && $("#field3").val() != "")


Make sure the input fields are named properly? They should have the id attribute for them set.


Do all three inputs have ids matching your selectors? You may also want to check that the type of the values is not undefined like so:

if(typeof($('#field1').val())!='undefined' ... 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜