I'm using this variable to get one or more values matching to what I need.
var mail = $("#dat").contents().find("td:contains('" + name + "')" ).siblings("td:nth-child(2)").map(function() { return $(this).text(); }).get();
My data look like this:
<tr><td> Name Second-Name </td><td>Email</td></tr>
<tr><td> Name Second-Name </td><td>Email 2</td></tr>
<tr><td> Name Second-Name Third-Name </td><td>Email 3</td></tr>
When I use Name Second-Name
as name
value, this variable returns Email
, Email 2
and Email 3
, even with Third-Name
inside the last table row. What I need is a variable that returns Email
and Email 2
only, ignoring the last row - where I have another name.
How can I do that? Thanks!