I was having issues with jQuery UI dialogs being hidden and not fully removed. Had same issues with both native dialog and the dialogwrapper plugin. The following code would hide, but not fully remove the div, for whatever reason:
To remove the element with id equal to removeme: jQuery(“#removeme”).remove(); To remove the element with id equal to removeme only if it is empty: jQuery(“#removeme:empty”).remove(); To remove all empty DIVs: jQuery(“div:empty”).remove(); If it’s not empty, but has whitespace: if(jQuery.trim(jQuery(“#removeme”).text()) == “”) { jQuery(“#removeme”).remove(); } Original Post: http://stackoverflow.com/questions/527246/use-jquery-to-remove-a-div-with-no-children