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
In JavaScript =
is used to assign values, while ==
and ===
are used to compare them.
When you put opening = true
in your if statement, you aren't checking if opening
is true
, you are setting opening
to true
. Try using ==
instead.
For example,
var x = 5;
if (x == 10) {
alert("x is 10");
} else {
alert("x isn't 10");
}
will display "x isn't 10", while
var x = 5;
if (x = 10) {
alert("x is 10");
} else {
alert("x isn't 10");
}
will display "x is 10".