Just seeing if anyone had any suggestions on making the following code cleaner that I have in my variation code section of Optimizely:
window.scrollBox();
$("#related-posts").css({"z-index":"1"});
$("#optslidebox").replaceWith("<div id=\"optslidebox\" style=\"z-index: 2; right: -999px;\">\n\t<a class=\"close\"></a>\n\t<p>Recommended</p>\n\t<h2>WHO ARE YOUR FAVORITE RAPPERS' FAVORITE RAPPERS RIGHT NOW?</h2>\n</div>");
$("#optslidebox > h2").wrapInner("<a href=\"http://greenlabel.com/sound/rappers-who-skate-skaters-who-rap/\"></a>");
This is what I want to append to the body (one can edit html in Optimizely, but it's very messy):
<div id="optslidebox">
<a class="close"></a>
<p>Recommended</p>
<h2><a href="#">WHO ARE YOUR FAVORITE RAPPERS' FAVORITE RAPPERS RIGHT NOW?</a></h2>
</div>
I'm wondering how I could store the div into a variable, and if it makes sense, the items within the optslidebox div. I'd also be interested in seeing how I'd implement all the variables to have them show up in the body.
Thanks in advance!