I have a collection of Div that I need to remember and loop is easy.
var myCollection = $ ('div.myClass'); $ .eec (my collection, function (maidew) {...});
Now I want to select some span tags in all the div, but only for those people who are direct children of the div. It works ...
$ Each (myCollection, function (myDiv) {$ ('span.error', $ (myDiv)). Each (function () {...});});
I do not want to work it in the following scenario
& lt; Div class = "myClass" & gt; & Lt; Div class = "myClass" & gt; & Lt; Span class = "error" & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;
[If I did not need to save the archive, then I would choose a child selector div.myClass & gt; Span.error
]
Try it out:
$ ('Div.myClass') each (function () {$ (this). Child ('span.error'). (Function () {var span_error = $ (this);});});
Comments
Post a Comment