title: Export HTML Table to Excel with ID or class tags in the table header
body: <p>I have a table in HTML on my webpage, and when using JQuery to export it to Excel, it will not work if I have any id or class tags in the table header. </p>
  
  <p>the JQuery i am using is </p>
  
  <pre><code>//wont work unless the table has no class or id
  $("#btnExport").click(function (e) {
  window.open('data:application/vnd.ms-excel,' + $("#tableForExcel").html());
  e.preventDefault();
  });
  </code></pre>
  
  <p>The table I am using is </p>
  
  <pre><code>&lt;table id='SearchTable' class='table table-bordered table-striped table-hover table blue '&gt;
  &lt;tr&gt;
  &lt;th class='ReportManager'&gt;Report Manager&lt;/th&gt;
  &lt;th class='ReportDetail'&gt;Report Detail&lt;/th&gt;
  &lt;th class='Form'&gt;Form&lt;/th&gt;
  
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td class='ReportManager'&gt;&lt;/td&gt;
  &lt;td class='ReportDetail'&gt;&lt;/td&gt;
  &lt;td class='Form'&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td class='ReportManager'&gt;&lt;/td&gt;
  &lt;td class='ReportDetail'&gt;&lt;/td&gt;
  &lt;td class='Form'&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I would be grateful if you could help me \ show me how i should adjust my code to get this to export. </p>