Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top