I have an html code as shown below in which big-block
div is empty. What I want to achieve is if big-block
div is empty
then apply css display:none
on hello-world
div.
<div class="hello-world">
<h1 class="widget__title">Hello World</h1>
<div class="big-block">
</div>
</div>
This is what I have tried but unfortunately its not working.
jQuery(document).ready(function ($) {
if($('.hello-world .big-block').text().length == 0) {
$('.hello-world').css("display", "none");
}
});