Reputation: 627
Why doesn't the background color change using the following code?:
if ($(".enteredCodeDisplay_1").css("background-color") == "rgb(255, 255, 255)" ) {
alert ("hi");
$("enteredCodeDisplay_1").css("background-color", "rgb(235, 46, 34)");
}
Note: i do get the alert and the if statement doesn't run when the color is not rgb(255, 255, 255)
Upvotes: 1
Views: 217
Reputation: 6349
You are missing .
on selector class
should be
$(".enteredCodeDisplay_1")
instead of
$("enteredCodeDisplay_1")
Upvotes: 2