To remove the element with id
equal to removeme
:
$("#removeme").remove();
To remove the element with id
equal to removeme
only if it is empty:
$("#removeme:empty").remove();
To remove all empty <div>
s:
$("div:empty").remove();
EDIT: If it's not empty, but has whitespace:
if($.trim($("#removeme").text()) == "") {
$("#removeme").remove();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…