I have this data in a table:
Red
Green
Blue
Yellow
Pink
Orange
I want to show an alert like this:
alert($(this).closest('tr').find("Orange").text());
But it does not work.
set an id field for each tr like
<tr id="1">
<td>Red</td>
<td>Green</td>
<td>Blue</td>
</tr>
<tr id="2">
<td>Yellow</td>
<td>Pink</td>
<td>Orange</td>
</tr>
then alert($(this).closest('tr').attr('id'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.