[jQuery] finding closest ancestor matching a pattern
Hi,
I am trying to find the closest ancestor whose id begins with "childrenTOC". I am invoking the function within the onclick handler of the element with class "toggleStrike". Previously, I was given this code
$(this).parents("div[@id^=childrenTOCItem]");
but that seems to return an arrray of elements, and I just want the closest one. Here is the HTML in question ...
<div id="childrenTOC10" style="display:block">
<div id="toc11" class="tocItem10-0" style="display:block; margin-left:10px">
<div style="display:block"><table>
<tbody>
<tr>
<td><a id="openClose164" class="openClose" href='#' onClick="javascript:toggleTOCItem('childrenTOC11', 'childrenTOC10', 0);"><img name="imgchildrenTOC11" src="images/tree_open.gif" alt="" border="0"></a></td>
<td style="text-decoration:none" id="item164" class="title1">Unit 1: Our Land and First People</td>
<td><a class="readMore" href='#'>Read</a></td>
<td><a href='#' class="toggleStrike">Remove</a></td>
</tr>
</tbody>
</table></div>
Thanks, - Dave
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/