joyacv2
asked on
How to get the corresponding th of a td using jQuery
Hi,
I have a table like this:
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?
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>
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.