我有以下psudeo html.我需要编写一些jquery,它隐藏任何不包含具有某个类'FacetItemsActive'的锚标记的表的行.
<table >
<tr>
<td>
<table>
<tr>
<td><a class='FacetItemsActive'/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
normal content
</td>
</tr>
<tr>
<td>
normal content
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我有这个功能很接近,但不是那里.你们中的任何一个jquery大师能帮助我吗?
function eiaHideNonSelectedFacets(){
// find the parent facet table
// find children tr of that table, and hide any rows that do not contain the class 'FacetItemsActive'
$('.FacetItemsActive').closest('table[facet]').find('tr').each(function(){
if (! $(this).is('.FacetItemsActive')){
$(this).hide();
}
});
}
Run Code Online (Sandbox Code Playgroud)