title: How to set attributes of a div tag dynamically?
body: <p>I am having a <code>div</code> and using javascript to set attribute for it with the below code</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>var m = document.getElementById('d1');
  m.setAttribute("height","50%"); 
  </code></pre>
  
  <p>but it throws an error as <em><code>setAttribute()</code> property cannot be set to the null reference.</em></p>
  
  <p><strong>My HTML Code</strong></p>
  
  <pre><code>&lt;div id="d1" style:"background-color:blue;"&gt; 
  </code></pre>