I want to access all the subelelements of a given element . For ex :
<div id="main">
<div id="1">
<span></span>
<span></span>
</div>
<span></span>
<div></div>
</div>
Like in abover structure #main
contains 5 elements ( 2 div and 3 span ). How can i access it all in a single query ?
您可以使用通用选择器。
$('#main *')
您只需要一个通配符选择器,如下所示:
$("#main *")
用这个:
$('#main').find('*');
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.