Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12171

Iterate over divs within an div

$
0
0

how can I iterate through the divs inside one div, and if they all have the same 'display' value('none'), display a message?I'm just learning and I need to use it one hundred percentjQuery

<div class="test1"><div class="test2" style="display:none"></div><div class="test2" style="display:none"></div><div  class="test2" style="display:none"></div><div  class="test2" style="display:none"></div></div>

I tried it using jQuery.each

  jQuery('.test1 > .test2').each(function(){    if(jQuery(this).css('display') == 'none'){        jQuery('.test_message').text('nothing');    }})

Viewing all articles
Browse latest Browse all 12171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>