jquery - find() or children() to search top-level children only for a style? -


I want to know that there is a child element, in which any of the two class styles is applicable to my code like this Looks:

  var listOfMatchedResults = $ ("# parentList"). Find ("MyStyle1, .myStyle2");  

My style is defined like this:

 . Parent li, .myStyle0 {} Parent li.myStyle1 {} Parent li.myStyle2 {}  

I do not have to cross more than one level from the level of children, such as:

  & lt ; Ul id = 'parentList' & gt; & Lt; Li & gt; & Lt; P & gt; Foo & lt; / P & gt; & Lt; P & gt; Grok & lt; / P & gt; & Lt; / Li & gt; & Lt; Li class = 'myStyle2' & gt; & Lt; P & gt; Here & lt; / P & gt; & Lt; P & gt; I! & Lt; / P & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; P & gt; Foo & lt; / P & gt; & Lt; P & gt; Grok & lt; / P & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

I do not know what () is doing, what is going on in each of these paragraph elements too? I need this only for top-level children - is there a way to specify it?

Thanks

yes it does

I need that to cross the top-level children - is there a way to specify it?

Yes, use

from the API doc:

.find () and. Children () Methods are the same, except that the latter makes only one journey, one level below the Dom tree.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -