I\'m trying to remove a specific div if a separate div is empty. Here\'s what I\'m using:
$(document).ready(function () { if (\'#leftmenu:empty\') {
I've encountered this today and the accepted answers did not work for me. Here is how I did it.
if( $('#div-id *').length === 0 ) { // your code here... }
My solution checks if there are any elements inside the div so it would still mark the div empty if there is only text inside it.