Can't make multiple if conditions in JavaScript?

前端 未结 6 579
一整个雨季
一整个雨季 2021-01-28 23:15

I have absolutely no idea why this is not working. Makes no sense to me.

This returns a \"syntax error: parse error\":

if ($(this).attr(\"id\") === \'se         


        
6条回答
  •  走了就别回头了
    2021-01-28 23:38

    the first example should read:

    if ($(this).attr("id") === 'search' || opening == true) return false;
    

    and the second:

    if (1 == 1 && 2 == 2) { return false; }
    

    Note the double equals (==) sign for logic equals is not the same as the single equals (=) sign, that handles variable assignment.

提交回复
热议问题