Earlier I asked the following question on how to add a HTML table row using JQuery, knowing the id on an element inside a table cell.
So, after adding the new row, the table look like this now:
<table id = "mytable">
<tr>
<th>Hiring Manager</th>
<td><textarea id = "textComments" cols = "15"/></td>
</tr>
<tr>
<td></td>
<td>
<span class = "CharCounter">
<span id="lblCharCounter">Label</span>
characters (500 max)
</span>
</td>
</tr>
I want to know, knowing the id of the first element (i.e. textComment), how can I select the second element located in the row below, (i.e. lblCharCounter)?
Thank for helping
I would probably go with:
or (to get that specific sub-
span)or something similar — It’s easiest if you assign a unique class, in addition to the ID, to that element you want to locate.
http://api.jquery.com/closest
http://api.jquery.com/find