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\') {
You can use .is().
if( $('#leftmenu').is(':empty') ) {
// ...
Or you could just test the length property to see if one was found.
if( $('#leftmenu:empty').length ) {
// ...
Keep in mind that empty means no white space either. If there's a chance that there will be white space, then you can use $.trim() and check for the length of the content.
if( !$.trim( $('#leftmenu').html() ).length ) {
// ...