[ACCEPTED]-Check if the content of a DIV is empty in jQuery-size
Accepted answer
If you mean really empty, use the empty-selector
[docs] :
alert( !!$("#unframed-items:empty").length )
or
alert( $("#unframed-items").is(':empty') )
If 2 you consider whitespace-only to be empty, then 1 use the jQuery.trim()
[docs] method:
alert( !$.trim( $("#unframed-items").html() ) );
<div id="portfolio"><!--portfolio-->
<div id="portfolio-works"><!--portfolio-works-->
<div class="portfolio-works-container"></div>
</div><!--/portfolio-works-->
$(document).ready(function(){
if($('div.portfolio-works-container').is(':empty')){
$('div#portfolio').hide();
}
});
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.