Hi there ...
I'm trying unsuccessfully to grab the id/index of the active pane of an
accordion widget. For example, using the example.html file that came with
jqueryUI, I have:
$("#accordion").accordion({ header: "h3"});
<h2 class="demoHeaders">Accordion</h2>
<div id="accordion">
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
</div>
<div>
<h3><a href="#">Second</a></h3>
<div>Phasellus mattis tincidunt
nibh.</div>
</div>
<div>
<h3><a href="#">Third</a></h3>
<div>Nam dui erat, auctor a, dignissim
quis.</div>
</div>
</div>
I then added a button which called a function in order to show me which
pane was active:
$("#testAcc").click(function() {
var foo =
$('#accordion').accordion('option', 'active');
alert(foo);
return false;
});
This function always reports 'null'. If I set the accordion's initial
structure to have active=false, the click function always returns
'false'. I must be daft here as in the documentation they say that this
pattern (('option', 'active')) is the getter for the active element, but
it seems to only ever report the initial state.
What am I missing here?
THanks
-J