when I append an element and afterwards remove it the object still exists?
bg = $('<div class="dialog_bg"></div>');
$('#'+elm).append(bg);
bg.remove();
how is that? isn’t it possible to remove the element permanently?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
so the element is removed from the DOM completely. That’s fine. Your question is how to ensure that the element is really removed.
I’d use the .parent() method for that. Because if the element is removed from the DOM it won’t have a parent anymore. This may be faster than
$("html").has(bg)because it doesn’t have to traverse the whole DOM Tree.