Search code examples
jqueryfixed-header-tables

click events on the fixed header


I have used fixed header from this gist in my code. I want to be able to click the header columns and sort the table based on which column header is clicked. But I cannot get hold of the click event on the the column.


Solution

  • Try this one

    $('.fixed-table').on('click', '.header-fixed th', function(){
        var th=$(this).index();
        alert('Column number is : ' + th + ' and text is : ' + $(this).text());
    });
    

    DEMO.