Frage

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

War es hilfreich?

Lösung

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 &&.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top