I am trying to change colors using a function and its parameters with template string, can't figure out the correct way of doing it. Can somebody help?
function colorize(choice,color){
choice.style.transition = 'all 450ms'
choice.style.borderColor = `"${color}"`
setTimeout(()=> choice.style.borderColor = 'rgba(60, 70, 127, 0.2)','700')
}
colorize(userDomChoice,green)
First, you don't need a template string for setting the border color
choice.style.borderColor = color;
Then add quotes around green
in the colorize
call
colorize(userDomChoice,'green');
Edit: Just as a note, you don't need the time in setTimeout to be in quotes
setTimeout(() => choice.style.borderColor = 'rgba(60, 70, 127, 0.2)',700);