Upon page load, I am looking to have an accordion displayed with an open state, showing a minus icon. When the accordion is closed, the icon should change to a plus.
Check out this example on fiddle
$('div.accordion-body').on('shown', function () {
$(this).parent("div").find(".icon-plus")
.removeClass("icon-plus")
.addClass("icon-minus");
});
$('div.accordion-body').on('hidden', function () {
$(this).parent("div").find(".icon-minus")
.removeClass("icon-minus")
.addClass("icon-plus");
});
Is there a way to set the default icon for an open accordion to be a minus?