Reputation: 153
I have a dynamic table and in one of the attributes of that table I have edit link, I want to fetch the data adjacent to that link if that link is clicked.
For example if I click Edit on line number 2, I should be able to retrieve Demo User, demouser, [email protected] and User using javascript.
Upvotes: 0
Views: 33
Reputation: 22673
The key is to access the row and then find elements inside that row:
$('.your-link').click(function () {
const row = $(this).closest('tr');
const whatever = row.find('.whatever').text();
})
Upvotes: 1