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' ...
精彩评论