jquery - How to select an element which parent is not specified class? -


i want hide element if parent not have class:

html

<li class="current_page_parent">     <a href="parent.html">parent</a>     <ul class="children">         <li>foo</li>         <li>bar</li>     </ul> </li> 

jquery

jquery("ul.children").hide(); 

currently hides <ul class="children"> regardless of class. close if parent :not <li class="current_page_parent">.

i've tried:

jquery("ul.children:not(:parent.current_page_ancestor)").hide(); 

with no luck.

try this:

jquery("li:not(.current_page_parent) ul.children").hide(); 

Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -