tags:

views:

12

answers:

1

I have given up doing this in pure js. And I can't find the jquery accordian stuff i was looking over when I started this project originally. What is the best way to do this? My code is linked here

+1  A: 

Here is jQuery UI Accordion.

All you need is:

<div id="accordion">
    <h3><a href="#">Section 1</a></h3>
    <div>
        <p>
        Paragraph 1
        </p>
    </div>
    <h3><a href="#">Section 2</a></h3>
    <div>
        <p>
        Paragraph 2
        </p>
    </div>
</div>

and

$(document).ready(function() {
    $("#accordion").accordion();
});
Jakub Konecki
This doesn't answer how to create the headinsg and sections with the variables.
lazfish
@lazfish - you're not actually asking for 'how to create the headinsg and sections with the variables', are you? If you want to generate DOM in js you might want to take a look at client-side templating (http://api.jquery.com/category/plugins/templates/)
Jakub Konecki
Yeah I am reading over that now. I thought this would be easy.
lazfish