Question

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)

Was it helpful?

Solution

You are missing . on selector class

should be

$(".enteredCodeDisplay_1")

instead of

$("enteredCodeDisplay_1")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top