I am trying to use the jquery closest command to find a particular element based on if the element has a particular sibling. I have been playing with different selectors but haven't been able to find one yet that does what I want.
So for example, if the structure was something like the following
<div>
<table>
<tr>
<td>
<span a>cell 1</span>
<span>cell 2</span>
</td>
<td siblingmatch="true">
<span b>cell 1</span>
<span>cell 2</span>
</td>
</tr>
</table>
<span siblingmatch="true">test 1</span>
</div>
If I ran closest starting from the span marked with a, I would want it to return it's parent td since it has a sibling marked with the siblingmatch attribute. However, if I ran the same command starting from the span marked with b, I would want it to return the table tag since this is the first parent it finds with a sibling marked with the siblingmatch attribute.