title: How to add 'id' to the tbody tag?
body: <p>I am trying to add 'id' to the tbody tag dynamically.
  How to add 'id' to the tbody tag dynamically ?
  Here is the code:</p>
  
  <pre><code>function tableCreate() {
      var body = document.getElementsByTagName('body')[0];
      var tbl = document.createElement('table');
      tbl.style.width = '100%';
      tbl.setAttribute('border', '1');
      var tbdy = document.createElement('tbody');
      for (var i = 0; i &lt; 3; i++) {
          var tr = document.createElement('tr');
          for (var j = 0; j &lt; 2; j++) {
              if (i == 2 &amp;&amp; j == 1) {
                  break
              } else {
                  var td = document.createElement('td');
                  td.appendChild(document.createTextNode('\u0020'))
                  i == 1 &amp;&amp; j == 1 ? td.setAttribute('rowSpan', '2') : null;
                  tr.appendChild(td)
              }
          }
          tbdy.appendChild(tr);
      }
      tbl.appendChild(tbdy);
      body.appendChild(tbl)
  }
  </code></pre>