This is a basic question, but I somehow can't find the answer.
I would like to pass a mix of string and variable as the value for an attribute, in the setAttribute() method.
This is what I have:
document.getElementById('mydiv').setAttribute("style", "width: 10%")
Instead of "width: 10%" I would like to have something like: "width: --myVar-- %"
All questions I find are related to passing only a variable but not how to mix both variable and string.
Thanx for any help!