I create an element dynamically:
var $el = $('<div class="someclass"></div>');
I want to append the element ($el) somewhere, but it shouldn’t have an id.
How do I know if it has been appended before or not?
edit
I thought this should work
if($($el, "#target").length == 0)
$("#target").append($el);
but that was wrong
You can simply check to see if it has a parent:
However, if you have no idea what is actually being done with the element, you may have other problems with your code.