Friday, 15 August 2014

javascript - Check if one of li doesnt have a class -


I'm having trouble with this condition: I have a series of Li's with the class, and I execute the code None of this wants to be a class.

For example:

  & lt; Ul class = "list-synthese" & gt; & Lt; Li class = "hidden" & gt; Lorem & lt; / Li & gt; & Lt; Li class = "hidden" & gt; Lorem & lt; / Li & gt; & Lt; Li class = "hidden" & gt; Lorem & lt; / Li & gt; & Lt; Li class = "hidden" & gt; Lorem & lt; / Li & gt; & Lt; Li & gt; Published in & lt; / Li & gt; & Lt; / Ul & gt;  

What do I want to do here:

  if $ ('list.synthese & gt; li') hasnotclass ('hidden') {mycode ; }  

Hope someone can help me! Thanks! :)

You can use the : not selector. You also have the wrong selector for the UL element:

  if ($ ('.list-synthese & gt; li: no (.hidden)'). Length) {mycode; }  

No comments:

Post a Comment