I have a table in HTML that holds names, addresses and phone numbers.
In each row for that table, there is a link you can select that opens up a popover. When a popover is selected, I would like to store the name for that specific row. The class associated with a name is
<td class="du-orl-1"> Daniel </td>
I am trying to store that name in a class via Javascript but this just seems to store the whole array of data rather than the specific element:
var objectId = $(".du-orl-1").html($(this).html());
Any ideas on what I am doing wrong?
The following jQuery should be helpful:
var objectId = $(this).closest('tr').children('td.du-orl-1').text();
Should give you the name on the row where the link was clicked.
Note: this refers to the anchor
element (link) that was clicked; therefore this piece of code should be inside the click
handler.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments