retrieving column header text

Hi , how to retrieve the text of a column header (<tr> <th> column name </th>.....'

when I click on a link inside  any <td> in that column ?
Who is Participating?
Tested it out here

This should work:
$(document).ready(function () {
    $('a.clicker').click(function() {
        var cell = $(this).parent();
        var index = $(this).closest('tr').children('td').index(cell);
        window.alert($('th:eq('+index+')', $(this).closest('table')).text());

Open in new window

Is there any distinquishing way to tell which column the link is in? Otherwise, you have to get all the TD's in the row and get the index of it and then select the TH with that index. I'll try and put something together.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.