There are two ways to do this, depending on the version of datatables .
EDIT for Datatables version 1.9 or less
You need to use fnHeaderCallback . With this callback, you can edit every th element in the table header.
I have created a working example for you. LIVE: http://live.datatables.net/oduzov CODE: http://live.datatables.net/oduzov/edit#javascript,html
Here is the code behind this (open the snippet to see the code):
$(document).ready(function($) { var table = $('#example').dataTable({ "fnHeaderCallback": function(nHead, aData, iStart, iEnd, aiDisplay) {
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://legacy.datatables.net/release-datatables/media/js/jquery.dataTables.js"></script> <table id="example" class="display" width="100%"> <thead> <tr> <th>Name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> </tr> </thead> <tfoot> <tr> <th>Name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> </tr> </tfoot> <tbody> <tr> <td>Tiger Nixon</td> <td>System Architect</td> <td>Edinburgh</td> <td>61</td> <td>2011/04/25</td> <td>$3,120</td> </tr> <tr> <td>Garrett Winters</td> <td>Director</td> <td>Edinburgh</td> <td>63</td> <td>2011/07/25</td> <td>$5,300</td> </tr> </tbody> </table>
For Datatables version 1.10 and later
the callback has a new name, it's just headerCallback . Everything else is the same, so use a new callback based on the deprecated api.
source share