Accordion append/refresh demo
Even though no panels are active, appending and refreshing causes the newly added panel to expand.
HTML
<link href="http://code.jquery.com/ui/jquery-ui-git.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-git.js"></script>
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<div id="accordion">
<h3>Section 1</h3>
<div>
<p>Section 1 content</p>
</div>
<h3>Section 2</h3>
<div>
<p>Section 2 content</p>
</div>
<h3>Section 3</h3>
<div>
<p>Section 3 content</p>
</div>
</div>
<button id="clickme">Add new section</button>
JavaScript
$("#accordion").accordion({
active: false,
collapsible: true
});
$('#clickme').button().click(function () {
$('#accordion').append('<h3>A new section</h3>');
$('#accordion').append('<div>New section content</div>');
$('#accordion').accordion('refresh');
});