I am working on some extension for a webpage and it has layout something like this.
<div class ="contents holder">
<name1 id="id1">
<name2 class="class1">
<div id="content">
<itemslist class="class3">
<div id="contents">
<renderer class="class4"></renderer>
<renderer class="class4"></renderer>
<renderer class="class4"></renderer>
</div>
</itemslist>
</div>
</name2>
</name1>
</div>
what i want is to loop through renderer items and i can do something like this.
$( 'renderer' ).each( function() {} );
But i want to specify the renderer from its parents and specify the parent from its parents and so on. something like this.
contents holder(class) --> name1 --> class1(class) -->
content(id) --> itemslist --> contents(id) ---> renderer
and then loop through all renderer items. how do i do this.
You can chain any id or class combination you want
$("#someid .someclass .someotherclass renderer").each ()
This will loop all renderers nested in that id and class chain
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.