I’m facing an issue that not sure if It’s possible to fix.
I have my element + script that loads after page load, but this only works when the element is placed in the index page. In the case, the element is placed in a hidden pop-up that turns visible when a button is pressed or X event happens, when the pop-up comes visible the element looks broken…
I think it’s because the element is loading before the parent div. So my idea is somehow to load-after the parent div element.
In the case, the element is placed in the index will work loading after the parent div (index) and in the case, the element is placed in a pop-up will load after that pop-up div.
I tried several methods but no luck on getting the right path to do (cause my pop-up div) is random and every time is different so can’t reference directly by id.
I tried things like this: $(''uploader'').insertAfter.parentNode
Hi @Raiikou, inserAfter() is a function and doesn’t have a parentNode property… did you mean something like this?
// Inserts `myElement` after the parent of the `#upholder` element, where
// `myElement` is a selector or reference to the element in question
$('#upholder').parent().after(myElement)
(Also note the “hashtag” for the ID selector, which you need if you don’t use getElementById() as in your other thread.)
Something like closest()? But I have to say that I find your description a bit too abstract to really help you with actual code… do you think you can set up a very basic example that demonstrates the problem? You might give some elements classes like unknown-class or something to make clear which references you can get directly and which not…