title: create table via javascript
body: <p>Currently I am creating a table through HTML as follows:-</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table class="table table-hover table-responsive"&gt; 
      &lt;thead&gt; 
          &lt;tr&gt; 
              &lt;th&gt;&lt;/th&gt;&lt;th&gt;Chamber&lt;/th&gt;     &lt;th&gt;Commitee ID&lt;/th&gt;     &lt;th&gt;Name&lt;/th&gt;     &lt;th&gt;Parent Committee&lt;/th&gt;     &lt;th&gt;Contact&lt;/th&gt;&lt;th&gt;Office&lt;/th&gt; 
          &lt;/tr&gt; 
      &lt;/thead&gt; 
      &lt;tbody&gt;  
          &lt;tr dir-paginate="user in committee_house|filter:search|itemsPerPage:10" pagination-id="committee_house"&gt; 
              &lt;td&gt;
                  &lt;div id="favourite_star"&gt;
                      &lt;i class="fa fa-star-o fa-2x favourite_icon" onclick="storeLocally()"&gt;&lt;/i&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td&gt;{{user.committee_chamber}}&lt;/td&gt; 
              &lt;td&gt;{{user.committee_id}}&lt;/td&gt; 
              &lt;td&gt;{{user.committee_name}}&lt;/td&gt; 
              &lt;td&gt;{{user.committee_parent_id}}&lt;/td&gt; 
              &lt;td&gt;{{user.committee_contact}}&lt;/td&gt; 
              &lt;td&gt;{{user.committee_office}}&lt;/td&gt; 
          &lt;/tr&gt; 
      &lt;/tbody&gt; 
  &lt;/table&gt; 
  &lt;div id="controls" class="controls" align="center"&gt;
      &lt;dir-pagination-controls pagination-id="committee_house" max-size="5" direction-links="true" boundary-links="true" &gt;
      &lt;/dir-pagination-controls&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Currently I am creating everything through HTML. I have dirPagination, search sort and am using a scope variable to store the values in javascript. I want to move this code fully to javascript as I will be needing to create this table again so I want to create a function. Here committee_house is the scope variable. How to do this whole thing in javascript without breaking any functionality. </p>
  
  <p>I tried to put the whole thing in a variable and set the innerHTML of that tag to the variable but it did not work out.</p>
  
  <p>Thanks for any help provided.</p>