I am able to export an HTML table using jquery if the <table> does not have an ID or class:
But if my table has either an ID or a class attr the following jquery kicks out a string of html in one cell to excel:
$( "#clickExcel" ).click(function() { var dtltbl = $('#dtltbl').html(); window.open('data:application/vnd.ms-excel,' + $('#dtltbl').html()); }); I can get around this by removing the tables classes and ID, but that's not ideal. Anybody have a solution?
<td id='td1'>becomes<tdid='td1'>. Also<td>This has a space</td>becomes<td>Thishasaspace</td>. I don't know how to fix it, just thought I would add. This is a pretty neat trick if you can get it working!<table>element, it turns into<tableid>which screws it all up. I have success with removing the ID and Class attr. Worse case I can wrap the table in a div, store the existing class and ID before deleting them, export it, then use the wrapped div to find the table and add the save ID and Classes back in, but damn thats ugly.