JQuery UI Accordion - Dynamic content?
So I setup the Accordion and got that to work. Then I got my JS for loop to display the content correctly. The issue I'm having is combining the two functions.
When I combined both the functionalities, only the first header shows up and all the links are visible. If the link area is clicked the header for that section appears. I've tried putting the jQuery accordion function in window.onload and under the rest of the content, but so far nothing I've tried has fixed the issue. Any help would be appreciated. Thanks!
JS
function list() {
var j; for (j=0; j < myArray.length; j++) {
document.write("<h3>"+myArray[j][0]+"</h3>");
document.write("<div class=#'>");
document.write("<div class='#'>");
document.write("<a href='"+myArray[j][1]+"/' class='#'>Link Name</a>");
document.write("</div></div>");
}
}
jQuery
$(function() {
$( "#accordion" ).accordion();
});