How to add to DOM

Hi,

I’d like to add an “Hello World” div to existing placeholder div on the product page. I’m using Custom Code → Wix backoffice → Settings → Custom Code. My script uses jQuery with $(window).on(‘load’. The “Hello World” div appears on the page briefly on page load then disappears? it’s as if another framework is running in the background beyond jQuery onload event. Is there another event handler I should be using, i’m quite blocked on this, any help would be really appreciated.

Thanks,
Joseph

Did you put it at the end of the body?

Hi J.D.

Yep, I had it at the end of the body already:-) It must be something else that’s not right

@joseph3559 I think it’ll be easier and less prone for unexpected break if you create the div and its contents using a Custom Element instead (assuming that you need for some reason to do it directly and not as Wix-Velo component.

@jonatandor35 thanks