views:

209

answers:

2

Hi Guy,

I am using the Jquery Accordion plugin.

I would like to when the page is loaded open a certain panel.

I am trying to this like so, by identifying it by ID:

selected = $("#1")
  $('ul.accordiontasks').accordion( {
    autoHeight: false,
    active: selected
  });

This does not seem to activate the accordion panel with the ID 1, can anyone see what I am doing wrong and maybe point me in the right direction?

Cheers

Eef

+3  A: 

HTML element ids can't start with numbers (ref), they have to start with letters. If your code snippet is accurate then your HTML isn't. Note also that you don't need to supply an element, you can supply the selector directly.

$('ul.accordiontasks').accordion( {
    autoHeight: false,
    active: '#menu1'
});
tvanfosson
A: 

You can always trigger it:

$("#1").trigger("click");
hgimenez