Rich-text Reply

Append / Prepend creates duplicate/repeat divs.

inigam 08-20-16

Append / Prepend creates duplicate/repeat divs.



I am trying to insert image on the page using append and prepend.

it creates duplicate images on the page. (can be seen in HTML as duplicate images or div or <a>).


Haven't got a resolve yet.

used document load, and few other tricks.


Any hints/pointers welcome.






Level 6

Reneevl 08-22-16

Re: Append / Prepend creates duplicate/repeat divs.

Hi there,


Thanks for reaching out to the Optimizely Community!


Are you using append and prepend at the same time? If so this might explain the duplication of your images. To prevent duplication select either append or prepend to insert your images. This way you will implement the images only once.


If you're are not using both I suggest checking out the Visual Editor article in the Optimizely knowledgebase where it explains how to use Insert Image in your Visual Editor and correctly implement your images in the right place.


I hope this helps!





Renée van Leijen
Technical Support Engineer
inigam 08-25-16

Re: Append / Prepend creates duplicate/repeat divs.



Thanks for the reply.

I checked for duplicate selectors, and obviously not using prepend and append together. also tried puting part code in Experiment JS and part in variation to call the Exp JS function and few other bits as well.


As I mentioned , after a couple seconds or so the image/div is again appended/prepended. This happened on more than one tests.


I have got a work around to stop the second time append if the #id already exist but wondering why this is occuring in the first place. It appears the variation code executes two times.


let me know probable reasons for it an if I can do anything from my end to stop this behaviour.









Level 6