Could you have this `sender.style.background = invalid_color;` in it's own line?