Yeak Yeak - 4 months ago 11
jQuery Question

jquery select new element outside of this.parent

i have teh following html

<tr>
<td class="schedule-available" style="background-color: rgb(255, 128, 128);"> 09:00 AM - 01:00 PM
<button class="btn btn-primary btn-xs viewOrder" type="button">ViewOrder</button>

</td>
</tr>

<tr>
<td class="sm-fnt lastName-holder">Last name: </td>
</tr>


currently with my code $(this).parent() is referring to the first what im trying to do now is also find the to be able to change the text from last name to something else please keep in mind i have mutliple lists like this so thats why i need to use $(this).parent

iv tried the following

$(this).parent().next('.lastName-holder').html('test');
$(this).closest('tr').next('.lastName-holder').html('test');


but neighter works

Answer

Try this $(this).parent().closest('tr').next().find('.lastName-holder').html('test');

Comments