I, for the life of me, can't seem to get tablesorter's download to CSV feature to work. I thought maybe it was something wrong with my setup so I created a bare-bone test table but still ran into the same issue.
According to the official documentation, I need tablesorter 2.8 or higher (I'm on 2.25.3) and jQuery 1.7 or higher (I'm pulling in jQuery 1.12.0). I followed Mottie's own simple setup from this question but I'm having no luck.
Below is my test code. I have to be missing something obvious but, after staring at it for hours, I'm not seeing it.
<head>
<title>Table to CSV</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.25.4/js/jquery.tablesorter.combined.min.js"></script>
</head>
<body>
<button class="download">Download CSV</button>
<table class="tablesorter">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Number</th>
<th>Food</th>
</tr>
</thead>
<tbody>
<tr>
<td>Billy</td>
<td>Bob</td>
<td>4</td>
<td>Pizza</td>
</tr>
<tr>
<td>Jill</td>
<td>Jackson</td>
<td>23</td>
<td>Tacos</td>
</tr>
<tr>
<td>Robert</td>
<td>Roy</td>
<td>6</td>
<td>Hamburger</td>
</tr>
</tbody>
</table>
<script>
$( document ).ready(function(){
var $table = $("table");
$table.tablesorter({
widgets: ["output"]
});
$('.download').click(function(){
$table.trigger("outputTable");
console.log("Download clicked.");
});
});
</script>
</body>
EDIT: Swapped out my own [local] tabelsorter script src with cloudflare's.