I'm trying to program a link for bootstraps accordion that will show all the accordion panels when clicked and then when clicked again all the panels hide.
I have it about 90% working, except the top panel is acting weird. When I click on the show all the very first time it will hide and the other menu's open up. When toggled back and forth though it starts to work as it should.
My jQuery looks like this
$('#accShow').on('click', function() {
if($(this).text() == 'View All') {
$(this).text('Hide All');
$('.collapse').collapse('hide');
} else {
$(this).text('View All');
$('.collapse').collapse('show');
}
return false;
});
and I have tried adding this, but it had no effect:
$('#collapseOne').collapse("show");