I'm working on a way to automatically expand a specific list item in a Simple jQuery Vertical Accordion Menu when the page loads. I attempted to include this code in the jQuery to open the first list item upon loading, but it doesn't appear to be functioning as expected:
$('#nav li:first ul').show();
The rest of the jQuery code is as follows:
<script type="text/javascript>
$(document).ready(function () {
$('#nav > li > a').click(function(){
if ($(this).attr('class') != 'active'){
$('#nav li ul').slideUp();
$(this).next().slideToggle();
$('#nav li a').removeClass('active');
$(this).addClass('active');
$('#nav li:first ul').show();
}
});
});
</script>
You can view the development page here.
Thank you!