javascript - Find the <th> of a clicked <td> in a table when <th> has span greater than 1 -


i'm trying find td's associated th cell, having trouble using jquery's index() , eq() functions since th's in table have spans of greater one.

i know can retrieve td's cellindex property, use find th? or there more appropriate way?

intended functionality click cell , have give me name of heading it's under. code sample: http://jsfiddle.net/kytda/

if want find corresponding table header given index of table cell can use following jquery (this assuming have table cell's index):

var th = td.closest('table').find('th').eq($td.index()); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -