1
I have a question, it is possible to exchange background as a condition?
Example:
function A() {
if (meuArray.length === 7) {
eu quero background verde
} else {
background azul
}
}
At first I’m making a card game called Black Jack or 21 in Brazil, and so far I haven’t found a viable way to by background or a CSS in the array that contains the values of each card.
Would anyone have a tip or how to do it? Thank you
Yes. Use
document.querySelector("#your-element").style.background = "#F00"
ordocument.querySelector("#your-element").style.setProperty("background", "url('your-image.png')")
– Valdeir Psr