Rich-text Reply

Resolving Optimizely Javascript Conflicts

CaioRunrunit 08-21-14

Resolving Optimizely Javascript Conflicts

[ Edited ]

Hi, are you ok? When I try to edit the lading page my javascript code no longer work. Doesn't matter if I just add a new div tag on the code, it always make my JS do not work.

For example the divs id="period" use some js code to change the prices columns and the div class="plan-button" use js code for a sign up pop up box. It work very well on my original experiment but, when I try to edit something on the HTML code doenst work any more.

My Experiment ID is: 1716920236

Please, this is an ASAP landing page to be released.

May someone help me with this?

Amanda 08-21-14

Re: javascript conflicts

Hi there. I took a look at your code and it looks like you are using extensive replaceWith, which means you are replacing HTML on your page. My suspicion is that this is what is causing the error where your functionality is not working like it used to. 


For reference, when you click "edit HTML" for an element, what is actually happening is that the new HTML is overwriting the existing HTML on the page.  Or, put another way, edit HTML hardcodes all the content you've selected to edit. This can sometimes cause you to accidentally overwrite dynamic functionality. 


My recommendation would be to avoid using the Edit HTML for large blocks of HTML. Make sure you choose a very specific section to update. Or, use the "edit text", "edit image" functionality instead.


For more information check out our support article here. 


Let me know if you have any questions or trouble with this.