Reputation: 273
I have a website that has an accordion with multiple accordions inside it. I was trying to determine the state(expanded/collapsed) of the outer accordion by using the $('#outer_accordion').hasClass('ui-state-active')
method to check.
However, this method returns true when inner accordion are expanded but the outer accordion are collapsed.
Is there any way to know if the outer accordion is expanded or collapsed regardless of the state of the inner accordion?
Thanks a lot in advance.
Upvotes: 1
Views: 27
Reputation: 380
Maybe getting the state of the according "active" or not (false means collapsed - according to the documentation) may help you: http://api.jqueryui.com/1.10/accordion/#option-active
in your case you can do:
// Getter
var active = $( "#outer_accordion" ).accordion( "option", "active" );
Upvotes: 1