HTML document has some HTML-Elements such as div, p, img, ...
Most of them are dynamically created ( if helpful css: "position:absolute;").
Every time after OnClick the element has to come to the front of other elements.
I mean:
element.parentNode.appendChild(element);
or
element.parent().append(element);
or
// E.g. with css as follows:
$('#ObjId').css('z-index', HighestIndx+1 );
I prefer the use of appendChild
, due to the css style z-index
won't be inserted into the element.
But I don't know whether the choice of appendChild
vs z-index
would be better.
My question: What is better to use z-index or append/appendChild ? Thanks.