Get the title of a column

  • Author: Alejandro Navarro
  • Requires: DataTables 1.10+

This plug-in will read the text from the header cell of a column, returning that value.

Plug-in code

$.fn.dataTable.Api.register( 'column().title()', function () {
    var colheader = this.header();
    return $(colheader).text().trim();
} );


This plug-in is available on the DataTables CDN:


Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN.

Version control

If you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome!


// Read the title text of column index 3
  var table = $('#example').DataTable();
  table.column( 3 ).title();