Rich-text Reply

Help! Error evaluating variation javascript when editing ul element

dafhowells 10-28-14

Help! Error evaluating variation javascript when editing ul element

Hi!!

 

I am fairly new to Optimizely and I am trying to create a variation of a homepage with an alternate nav bar. 

Initially I edited the HTML of the page in an external IDE and inserted this into the variation code field. Unfortunately I got a few syntax errors:

- Expected an identifier and instead saw '<!'

- Expected an assignment or function call and instead saw an expression

- Missing semicolon

 

I got the same when I tried to edit the HTML of the nav bar element itself via the editor UI. I am looking to edit the contents of the "primaryNav" element with the new menu items (code below). 

The experiment ID is  # 2113291328 so can someone perhaps see where I am going wrong?

Hope you can help!!!

 

Daf


 

<ul id="primaryNav" class="shadow">
   <li><a class="expander" href="#">Knee</a><ul>
         <li><a href="/tim-knee3?showACL">ACL</a></li>
         <li><a href="/tim-knee3?showCartilage">Cartilage</a></li>
         <li><a href="/tim-knee3?showCollateral">Collateral Ligaments</a></li>
         <li><a href="/tim-knee3?showFracture">Fracture</a></li>
         <li><a href="/tim-knee3?showMalalignment">Malalignment</a></li>
         <li><a href="/tim-knee3?showMeniscus">Meniscus</a></li>
         <li><a href="/tim-knee3?showPatellofemoral">Patellofemoral</a></li>
         <li><a href="/tim-knee3?showPCL">PCL</a></li>
         <li><a href="/tim-knee3?showOther">Other</a></li>
      </ul>
   </li>
   <li><a class="expander" href="#">Shoulder</a><ul>
         <li><a href="/tim-shoulder">AC joint</a></li>
         <li><a href="/tim-shoulder?showcartilage">Cartilage</a></li>
         <li><a href="/tim-shoulder?showfracture">Fracture</a></li>
         <li><a href="/tim-shoulder?showinstability">Instability</a></li>
         <li><a href="/tim-shoulder?showslap">Proximal biceps/SLAP</a></li>
         <li><a href="/tim-shoulder?showrc">Rotator cuff</a></li>
         <li><a href="/tim-shoulder?showother">Other</a></li>
      </ul>
   </li>
   <li><a class="expander" href="#">Hip</a><ul>
         <li><a href="tim-hip?showcartilage">Cartilage</a></li>
         <li><a href="tim-hip?showea">Extra-articular</a></li>
         <li><a href="tim-hip?showfracture">Fracture</a></li>
         <li><a href="tim-hip?showimpingement">Impingement</a></li>
         <li><a href="tim-hip?showinstability">Instability</a></li>
         <li><a href="tim-hip?showlabrum">Labrum</a></li>
         <li><a href="tim-hip?showligamentum">Ligamentum teres</a></li>
         <li><a href="tim-hip?showother">Other</a></li>
      </ul>
   </li>
   <li><a class="expander" href="#">Elbow</a><ul>
         <li><a href="/tim-elbow2?showcartilage">Cartliage</a></li>
         <li><a href="/tim-elbow2?showdb">Distal biceps</a></li>
         <li><a href="/tim-elbow2?showElbowEpicondylitis">Epicondylitis</a></li>
         <li><a href="/tim-elbow2?showfracture">Fracture</a></li>
         <li><a href="/tim-elbow2?showinstability">Instability</a></li>
         <li><a href="/tim-elbow2?showucl">UCL</a></li>
         <li><a href="/tim-elbow2?showElbowOther">Other</a></li>
      </ul>
   </li>
   <li><a class="expander" href="#">Foot &amp; Ankle</a><ul>
         <li><a href="/tim-footankle?showcartilage">Cartilage</a></li>
         <li><a href="/tim-footankle?showfracture">Fracture</a></li>
         <li><a href="/tim-footankle?showinstability">Instability</a></li>
         <li><a href="/tim-footankle?showligament">Ligament</a></li>
         <li><a href="/tim-footankle?showplantarfascia">Plantar fascia</a></li>
         <li><a href="/tim-footankle?showtendon">Tendon</a></li>
         <li><a href="/tim-footankle?showother">Other</a></li>
      </ul>
   </li>
   <li><a class="expander" href="#">Hand &amp; Wrist</a><ul>
         <li><a href="/tim-wrist?showcarpaltunnel">Carpal tunnel</a></li>
         <li><a href="/tim-wrist?showcartilage">Cartilage</a></li>
         <li><a href="/tim-wrist?showfracture">Fracture</a></li>
         <li><a href="/tim-wrist?showinstability">Instability</a></li>
         <li><a href="/tim-wrist?showligament">Ligament</a></li>
         <li><a href="/tim-wrist?showtendon">Tendon</a></li>
         <li><a href="/tim-wrist?showtfcc">TFCC</a></li>
         <li><a href="/tim-wrist?showother">Other</a></li>
      </ul>
   </li>
   <li><a href="/tim-other">Other</a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a href="" target="yes"></a></li>
   <li><a class="expander" href="#">Journal Info</a><ul>
         <li><a href="/aims">About the Journal</a></li>
         <li><a href="http://www.elsevierhealthcareers.com" target="yes">Career Opportunities</a></li>
         <li><a href="/contact">Contact Information</a></li>
         <li><a href="http://www.arthroscopyjournal.org/edboard" target="yes">Editorial Board</a></li>
         <li><a href="http://www.elsmediakits.com/journal_home/details/XATS" target="yes">Info for Advertisers</a></li>
         <li><a href="/authorinfo">Instructions for Authors</a></li>
         <li><a href="/content/permission">Permissions</a></li>
         <li><a href="http://ees.elsevier.com/arth/" target="yes">Submit your Manuscript</a></li>
      </ul>
   </li>
</ul>

 

 

 

dafhowells 10-28-14
 

Re: Help! Error evaluating variation javascript when editing ul element

Actually a colleague has pointed out where I was going wrong.

All sorted now.
MartijnSch 10-28-14
 

Re: Help! Error evaluating variation javascript when editing ul element

Care to share? Could be pretty valuable for other people as well. I guess, the problem was at least that you tried to add the HTMl all in the variation code where you need to add JS there.
dafhowells 10-28-14
 

Re: Help! Error evaluating variation javascript when editing ul element

That was it MartijnSch,

I didn't realize only JS should go in the variation code. When I reverted to editing the HTML of the element I also hadn't removed the code that I mistakenly added to the variation code field so I was getting the same error.