I'm trying to get one div to show if another is empty. This needs to happen multiple times throughout a page. The script won't work in its present state.
Script:
$('.standard_page_list_result').each(function(){
if ($('.children p').length == 0)
$('.summary').css("display", "block");
});
HTML:
<div class="standard_page_list_result"><div class="children"><p>Hello</p></div>
<div class="summary"><p>Goodbye</p></div></div>
<div class="standard_page_list_result"><div class="children"><p>Hello</p></div>
<div class="summary"><p>Goodbye</p></div></div>
<div class="standard_page_list_result"><div class="children"><p>Hello</p></div>
<div class="summary"><p>Goodbye</p></div></div>
<div class="standard_page_list_result"><div class="children"><p></p></div>
<div class="summary"><p>Hello!</p></div></div>
CSS:
.summary { display: none; }