문제

I know this might sound like a basic question but I have the following code to test that a form's fields aren't empty:

$('.button_overlay').mouseover(function() {
    if ($.trim($("#field1").val()) != "" && $.trim($("#field2").val()) != "") {
        $('.button_overlay').css('display', 'none');
    }
 });

But I keep getting a "Uncaught SyntaxError: Unexpected token ILLEGAL" error. I'm not sure why this isn't valid though. Anyone able to give some pointers?

Thanks

도움이 되었습니까?

해결책

Okay I really couldn't find what the issue was so I just created a nested if statement within the main if statement. This achieves the same effect as the &&.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top