How to create a div with jQuery accordion

Posted by skdnewbie on Stack Overflow See other posts from Stack Overflow or by skdnewbie
Published on 2012-11-28T14:48:56Z Indexed on 2012/11/28 17:05 UTC
Read the original article Hit count: 120

Filed under:
|

Im using this:

<script>
    $(function() {
        $( "#accordion" ).accordion();
    });
</script>

To get the effect of expand/collapse. (If you know a better plugin or method, pls notice me)

I have this div: <div id ="accordion"></div>

And this code to create a button inside that div. (dont worry about the content of button)

$('#button_submit').click(function() 
{
$("#accordion").append(
$("<button id=saved"+j+">").click(function() {
drawChart.apply(null, myArray);
}).html("<b>Start date:</b>"+""+myArray[0]+"\n<b>End date:</b>"+myArray[1]+"\n<b>Chart type:</b>"+myArray[2]+"")
);

My question is, how to create/format div accordion to have this effect accordion effect jquery .

being that the <button id=saved"+j+"> should appear inside the sections.

Cheers

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery