Rich-text Reply

Preview not showing .insertAfter change

Eva 04-29-16
Accepted Solution

Preview not showing .insertAfter change

Hi,

 

I'm trying to add some content using insertAfter. It works fine in the editor, but when I preview the page the content doesn't show up. It works when I use .append or .prepend but those don't get me the sequence order that I need.

 

I'm not sure what the problem is, maybe something to do with pageload? But it doesn't make sense for .prepend to work, considering that I use the same element ID as selector.

 

Anyone know how I might fix this issue?

Eva
Level 2

JasonDahlin 04-29-16
 

Re: Preview not showing .insertAfter change

Hi @Eva - Can you share a URL of a page where you are trying to run the code and the ID of the experiment you are using?

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Eva 04-29-16
 

Re: Preview not showing .insertAfter change

Yes of course! Thanks for responding. URL is https://www.vanhelden.nl/schrijfwaren/pennen and experiment ID is 5779340602
Eva
Level 2
JasonDahlin 04-29-16
 

Re: Preview not showing .insertAfter change

Hi @Eva - Unfortunately, I don't see anything blatantly "wrong" and the selectors you are using match what is returned from the webserver, so it's not like you are trying to use elements that don't exist yet.

 

I noticed that the $ commands did not work for me, but that may be because of all the blockers I have running on this machine... to make the experiment work via console, I had to use jQuery instead of $.

 

A couple things to try:

1- change your commands from $ to jQuery

2- change your commands from $ to window.jQuery

3- make your code wait for window.load (and maybe also changed to use window.jQuery):

$(window).load(function() {
 // executes when complete page is fully loaded, including all frames, objects and images
 //your code here
});

 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Eva 05-03-16
 

Re: Preview not showing .insertAfter change

Thanks for the tips! Changing it to jQuery from $ seems to have done the trick. Which is really weird, because I use $ for all the other tests and it works fine there. So I don't really understand why this works, but as long as it works I'm happy!
Eva
Level 2