title: How do I add a class to THEAD created by datatables?
body: <p>I am creating a datatable using javascript. The application itself uses bootstrap and all tables are currently styled by adding the &quot;thead-dark&quot; class to . However datatables does not add this class when generating using sourced data. I went through datatables documentation but could not find a solution already builtin. So I went to google and tried a few different things, but no success. I am skilled with PHP but I do not have much experience with Javascript. And since this table is to be used as a document manager, PHP is not very well suited for this job. Because I would need to reload the page all the time.</p>
  <p>Thanks for your help!</p>
  <p>HTML:</p>
  <pre><code>&lt;div class=&quot;tab-pane&quot; id=&quot;documents&quot;&gt;
      &lt;div class=&quot;table-responsive&quot;&gt;
          &lt;table id=&quot;documents_tbl&quot; class=&quot;table table-hover table-striped table-bordered dt-responsive&quot; style=&quot;width:100%&quot;&gt;&lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>JAVASCRIPT:</p>
  <pre><code>&lt;script&gt;
      var dataSet = [
        [ &quot;Tiger Nixon&quot;, &quot;System Architect&quot;, &quot;Edinburgh&quot;, &quot;5421&quot;, &quot;2011/04/25&quot;, &quot;$320,800&quot; ],
        [ &quot;Garrett Winters&quot;, &quot;Accountant&quot;, &quot;Tokyo&quot;, &quot;8422&quot;, &quot;2011/07/25&quot;, &quot;$170,750&quot; ],
        [ &quot;Shou Itou&quot;, &quot;Regional Marketing&quot;, &quot;Tokyo&quot;, &quot;8899&quot;, &quot;2011/08/14&quot;, &quot;$163,000&quot; ],
        [ &quot;Michelle House&quot;, &quot;Integration Specialist&quot;, &quot;Sydney&quot;, &quot;2769&quot;, &quot;2011/06/02&quot;, &quot;$95,400&quot; ],
        [ &quot;Suki Burks&quot;, &quot;Developer&quot;, &quot;London&quot;, &quot;6832&quot;, &quot;2009/10/22&quot;, &quot;$114,500&quot; ],
        [ &quot;Prescott Bartlett&quot;, &quot;Technical Author&quot;, &quot;London&quot;, &quot;3606&quot;, &quot;2011/05/07&quot;, &quot;$145,000&quot; ],
        [ &quot;Gavin Cortez&quot;, &quot;Team Leader&quot;, &quot;San Francisco&quot;, &quot;2860&quot;, &quot;2008/10/26&quot;, &quot;$235,500&quot; ],
        [ &quot;Martena Mccray&quot;, &quot;Post-Sales support&quot;, &quot;Edinburgh&quot;, &quot;8240&quot;, &quot;2011/03/09&quot;, &quot;$324,050&quot; ],
        [ &quot;Unity Butler&quot;, &quot;Marketing Designer&quot;, &quot;San Francisco&quot;, &quot;5384&quot;, &quot;2009/12/09&quot;, &quot;$85,675&quot; ]
      ];
      $(document).ready(function() {
        $('#documents_tbl').DataTable({
          data: dataSet,
          columns: [
            { title: &quot;Name&quot; },
            { title: &quot;Position&quot; },
            { title: &quot;Office&quot; },
            { title: &quot;Extn.&quot; },
            { title: &quot;Start date&quot; },
            { title: &quot;Salary&quot; }
          ]
        });
      });
  &lt;/script&gt;
  </code></pre>