title: How to add an attribute dynamically using javascript
body: <p>I want to get an element using id:</p>
  
  <pre><code>var a = document.getElementById("hello");
  </code></pre>
  
  <p>and then dynamically add an attribute to it called "labelText" and assign the value "{labeltext}" to it.</p>
  
  <p>do i need to use concatenation? </p>
  
  <p>i tried the following but it didn't work:</p>
  
  <pre><code>document.getElementById("hello").setAttribute("labelText", "'{' + labelText + '}' ");
  </code></pre>