I have an asp:Repeater that makes a table with a few <td>s and <tr>s. In each of the <tr>s, I have an <a></a>.
Now, on a certain event I want to change just the <a></a> tag in the <tr>.
So, I want to do something like:
$("a").text("I changed!");
, but I only want to change the <a>.text in one <tr>, not all the <a> elements on the page.
I am experimenting with .closest(), but unfortunately don’t know enough about jQuery to make this functional.
if you have the target
trsomehow, then you can use the following code to find theatag inside that:How to find
trreally depends on what context you are in and how your targettris identified from others.e.g. if it’s the “first” tr you may say:
if it’s the element that the event has happened for (e.g. click event):
if you are in the event of a child element of target
tryou may say: