I am trying to check for the background of an element, here is my code. But it doesn't work:
I tried two ways, here is the first:
function changeColor(field) {
if(field.css('background-color','#ffb100')) {
field.css('background-color','white');
}
else {
field.css('background-color','ffb100');
}
}
here is the second:
function changeColor(field) {
if(field.css('background-color') === '#ffb100') {
field.css('background-color','white');
}
else {
field.css('background-color','ffb100');
}
}
But neither worked! Any suggestions?