How can we destroy active accordion with all the content is have in it.
I started with this function
function DesctroyThisAccordion() {
var active = jQuery("#accordion").accordion('option', 'active');
jQuery("#accordion").accordion('option', 'active').remove('h3');
jQuery("#accordion").accordion('option', 'active').remove('div');
}
I am using jQuery UI plugin for accordion
I am trying to find the active accordion and delete its h3 and div content.
i works if i select the last in accordion
//jQuery("h3[class^='Title']:last").remove('h3');
//jQuery("div[class^='ui-accordion-content']:last").remove('div');
But i want it for active accordion
any help would be greatly appreciated.
I used:
$("#myAccordion").accordion("destroy"); // Removes the accordion bits
$("#myAccordion").empty(); // Clears the contents
If you only empty the accordion container, it still retains accordion properties and will not be reusable as an accordion. Here's the destroy documentation.