Despite researching various topics on using background colors in if statements, I have yet to find a satisfactory solution. Whether I define an element as a variable beforehand or use rgb/rgba values, my code does not produce the desired results; it always passes straight to the else statement.
var element = $("#ARCStatusBox3EQETD");
console.log($('#ARCStatusBox1EQETD').css('backgroundColor'));
if(element.css('background-color') == "rgb(220,20,60)") {
$('#HomeStatus1').css("background-color", "#dc143c");
}
else if ($('#ARCStatusBox2EQETD').css('background-color') == '#daa520' || $('#ARCStatusBox2EQETD').css('background-color') == '#daa520' || $('#ARCStatusBox1EQETD').css('background-color') == '#daa520'){
$('#HomeStatus1').css("background-color", "#daa520");
}
else {// ($('#ARCStatusBox3EQETD').css('background-color') == '#7cfc00' || $('#ARCStatusBox2EQETD').css('background-color') == '#7cfc00' || $('#ARCStatusBox1EQETD').css('background-color') == '#7cfc00'){
$('#HomeStatus1').css("background-color", "#7cfc00");
}
I have shared my code here and unfortunately, it does not work whether I use hex codes or rgb/rgba values.
If anyone has a solution, I would greatly appreciate your help.