select the first td when select a td in the same column using jquery

Hi,

I need to select the td corresponding to the td in the first row when i select a td in a any row in a table, any idea?
LVL 1
joyacv2Asked:
Who is Participating?
 
Rainer JeschorCommented:
Hi,
here we go:
$(document).ready(function () {
    $("td").on("click", function() {
        var colIndex = parseInt($(this).index());
        var table = $(this).closest('table');
        alert($("tr:eq(0) td:eq("+colIndex+")",table).text());
    });
});

Open in new window

Sample:
http://jsfiddle.net/EE_RainerJ/ku857gxy/

HTH
Rainer
0
 
joyacv2Author Commented:
works excellent!
0
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.