I have looked at other topics regarding if statements with background colors as conditions; however, have not found a viable answer. Whether I create an element as a variable beforehand, or use rgb or rgba, I get no results, and the if passes through straight to the else.
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");
}
There is my code, it works neither as == hex code or rgb/rgba.
Any help with a solution is greatly appreciated.