const color1="red"
$(`.shape${i}`).css(``background-color`,`${color1}`)
I wrote that, but it doesn't work when I look at it in my browser.I googled a lot, but I couldn't find it.
If you don't mind, I'd like to help you.Please.
The part enclosed by the backquote ` is a single string, so the code provided calls the css()
function with one argument: "background-color", "red"
.
background-color
and red
are meant to be two separate strings, so
$(`.shape${i}`).css("background-color", `${color1}`);
Or
$(`.shape${i}`).css("background-color", color1);
will be
© 2024 OneMinuteCode. All rights reserved.