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