I am using javascript and trying to change the colour of a button clicked using event interface but in hex format but the browser is saying it doesn't recognise it, but I don't seem to have an issue with this using written colours ('green' for example). Is it impossible to set colour using hex values, if it isn't what am I doing wrong? Code below:
e.currentTarget.style.backgroundColor = '#F0F0F0'
EDIT: I think I may have found out what the problem is, I am trying to apply another colour to the event after the first colour change. Could this be the problem? See below:
if (e.currentTarget.innerHTML == questions[index].correct) {
e.currentTarget.style.backgroundColor = "green";
function revertBtnColour2(){
e.currentTarget.style.backgroundColor = '#F0F0F0';
}
if(e.currentTarget.style.backgroundColor = "green"){
setTimeout(revertBtnColour2, 200)
}