I am trying to dynamically build an array within Foundation 6's accordion menu by using pure javascript. I cannot seem to figure out how to inject data-accordion-menu into the div. The original code looks like this:
<div class="button_moreinfo row">
<ul class="vertical menu" data-accordion-menu>
<li>
<a href="#">Saturday, 3/19 @ 6:05PM</a>
<ul class="menu vertical nested">
<li><a href="#">Person A has 25pts</a></li>
<li><a href="#">Person B has 5pts</a></li>
<li><a href="#">Person C has been pulled from the game for a sprained ankle</a></li>
</ul>
</li>
</ul>
</div>
I am trying to rebuild it dynamically with this:
newElementAC2.id=vertical_menu[0];newElementAC2.className ="vertical menu";
newElementAC2.setAttribute('data',"data-accordion-menu");
newElementAC1.appendChild(newElementAC2);