Skip to main content
Home / Code Snippets / jQuery Code Snippets / Check for Empty Elements

Check for Empty Elements

Do something for each empty element found:

$('*').each(function() {
         if ($(this).text() == "") {
                   //Do Something
         }
});

TRUE or FALSE if element is empty:

var emptyTest = $('#myDiv').is(':empty');
icon-link icon-logo-star icon-search icon-star