Need to hide parent element of inner element with name attribute by using closest as shown
<tr>
<td nowrap="true" valign="top" width="113px" class="ms-formlabel">
<span class="ms-h3 ms-standardheader">
<a name="SPBookmark_PatientInitials"></a>Patient Initials</span></td>
<td valign="top" class="ms-formbody" width="350px" id="SPFieldText">
WR
</td>
</tr>
example is as below
.closest("tr> td span a ").attr('name', 'SPBookmark_' + ctx.ListSchema.Field[0].Name).hide();
2
Answers
Assuming I understand what you are asking for, you can use the CSS attribute selector to achieve your goal (thanks to Scott for pointing out this is CSS not jQuery in the comments). Take this example:
See the docs for more info: https://api.jquery.com/attribute-equals-selector/
.closest()
should be called on the inner element and be supplied a valid CSS selector that should match some ancestor element. Your code:looks like it’s trying to find what your code has as the inner element by starting at the ancestor and working downward..