jQuery accordion - Open item on page load

fightstarr20 picture fightstarr20 · Sep 3, 2012 · Viewed 19.7k times · Source

I have a real simple jQuery accordion based on http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/

Everything works fine but I would like it to automatically have the first item in the list open when the page loads

I have everything in a jsfiddle at http://jsfiddle.net/HJ8c7/

Can anyone help?

Answer

Endy picture Endy · Sep 3, 2012

Do:

$( "#accordion" ).accordion( "option", "active", 0 );

It will open the first element.