Rich-text Reply

Changing body class on a variation in Editor

BenH 04-24-14

Changing body class on a variation in Editor

I want to change the body class for one of my page variations, but I can't seem to edit that with the Editor interface.

 

The highest level DOM node I can edit seems to be my wrapper div, if I try to right-click then Select Container, then body and html are greyed out.

 

How can I add this to a page variation...

 

<body class="my-class">

 

Thanks in advance.

BenH

Level 1

tasin 04-24-14
 

Re: Changing body class on a variation in Editor

Hey Ben

 

You can try adding the following line of code to your variation 'Edit code' section (which usually sits at the bottom of the editor):

 

$("body").addClass("my-class");

 

And then Apply and save the variation.

 

Hope this helps.

 

Regards
Tasin

Level 1
tobyurff 05-01-14
 

Re: Changing body class on a variation in Editor

Hi BenH!

Tasin already answered your question, I hope you managed to get it working.

In addition to this, I've added your request as an improvement suggestion so that our product team can consider it as they enhance the editor.

Thanks,
Toby
Optimizely