Link to home
Start Free TrialLog in
Avatar of joyacv2
joyacv2Flag for Puerto Rico

asked on

Corresponding th of a td using jQuery

Hi,

I have a table like this:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr><td>345</td><td>450</td><td>385</td></tr>
<tr><td>3</td><td>1</td><td>850</td></tr>
<tr><td>3450</td><td>4509</td><td>3857</td></tr>
</tbody>
<table>

Open in new window


i need to get the corresponding th of the td on click and send an alert with the th name. For example on click in 345 alert Header 1, click on 3857 alert Header 3.

Using jQuery, any idea?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joyacv2

ASKER

works perfect!!!