I have a jQuery accordion defined like:
$("#acrd").accordion({
autoHeight: false,
header: '.navhead',
alwaysOpen: true,
navigation: true,
collapsible: true,
disabled: true
});
When a client clicks on a button, I call a function DoSomething(), like this:
function DoSomething(id) {
$.ajax({
url: "getapage.php?id="+id,
cache: false
}).done(function( html ) {
if(html == 'OK') {
$("#acrd").accordion({ active: 1 }); // doesn't work
} else {
alert("Give an error!");
}
});
}
But nothing happens when I click the button, I checked Firebug and there is no syntax error.
How can I accomplish this? (without enabling the accordion in the process, the client must not be able to change the accordion active state)
You probably meant to use the
activatemethod, which activates the specified content part:However, that won’t work while the accordion is disabled. So you need to write it as