title: Adding class name or id to Table with JS
body: <p>Suppose this code to create a table with <strong>plain</strong> JavaScript using DOM (<a href="https://jsfiddle.net/hkqfLwbx/" rel="nofollow">Fiddle</a>):</p>
  
  <pre><code>var table = document.createElement('table');
  for (var i = 1; i &lt; 4; i++){
      var tr = document.createElement('tr');   
  
      var td1 = document.createElement('td');
      var td2 = document.createElement('td');
  
      var text1 = document.createTextNode('Text1');
      var text2 = document.createTextNode('Text2');
  
      td1.appendChild(text1);
      td2.appendChild(text2);
      tr.appendChild(td1);
      tr.appendChild(td2);
  
      table.appendChild(tr);
  }
  document.body.appendChild(table);
  </code></pre>
  
  <p>How can I add a class name or an id to its cells?<br>
  For example I want to be able to modify cells after their creation, so I want just :</p>
  
  <pre><code>table.getElementsByClassName("class").style.font-weight: "bold"; 
  </code></pre>