Rich-text Reply

Problem with Button colour

TomWittig 10-23-16

Problem with Button colour

Hi there, in an experiement I have set up I want to test the colour of a button. But the new colour does not render and is not presented in the variation. 

The diagnostic report says that it is implemented correctly and it shows the correct snippet ID: 

Any suggestions how to fix it?

Thanks from 

Tom 

Breana_Eads 10-24-16
 

Re: Problem with Button colour

Hi Tom,
When changing the button color you should have code that should look something like :
$(".buttonElement").css({"background-color":"#ac231e"});
Where ".buttonElement" = the element of your button you wish to change.
"background-color": can be given a hex color or an rgb color.


Be aware that if the element that you are changing the color on is already affected by !important in the original version, your variations must also have !important added to it.  jQuery does not lend itself to using !important directly so you would need to set up a separate class in your CSS that uses !important, then use .addClass in your jQuery code.  It would looks something like :

<--- CSS --->

.myClass {

background-color: #ac231e !important;

}

<--- jQuery --->

$(".buttonElement").addClass("myClass);

 

If your experiment already includes code like the above the next step I would take is QA'ing your test. The article below walks you through several test on how to do that.

How to QA your experiment 

 

Breana Eads
Optimizely