Is there a way to see if a layer has a sub layer with a specific class.
so in my html i have;
html
<div class='tab'>
<div class='not-loaded'></div>
</div>
JS/JQ
$('.tab').contains('not-loaded'); //to return a Boolean OR
$('.tab').classExist('not-loaded'); //to return a Boolean
Basicly I want to check if my tabs have already loaded the dynamic html content.
Test for length using find
if($('.tab').find('.not-loaded').length)
Or using has
if($('.tab:has(".not-loaded")').length)
您也可以将:first-child与选择器一起使用。
$('.tab :first-child').hasClass('not-loaded');
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.