jQuery UI Library Accordion Basic Usage


Example

To use an accordion, one must have headers and content inside the headers in their HTML. Then one must instantiate the accordion() method of jQuery UI.

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

In the HTML:

<div id="accordion">
    <h3>First header</h3>
        <div>First content panel</div>
    <h3>Second header</h3>
        <div>Second content panel</div>
</div>

enter image description here