I have a block of HTML that looks like this:
<div data-toggle="collapse" data-parent="#groupOptions" data-target="#group" aria-expanded="true" aria-controls="group" class="collapsable-group-header">
<h3><span class="glyphicon glyphicon-chevron-right toggle"></span> Group</h3>
</div>
This HTML is using Bootstrap's collapse control. The behavior works fine. I'm now trying to change the glyphicon from right to down. To do that, I have the following:
$('#group')
.on('show.bs.collapse', function () {
var $toggle= $('#group > .toggle');
$toggle.removeClass('glyphicon-chevron-right');
$toggle.addClass('glyphicon-chevron-down');
console.log($toggle.html());
})
.on('hide.bs.collapse', function() { alert('hiding...'); })
;
Unfortunately, this is not working. My console.log statements are printing undefined. Yet, if I do console.log($toggle) I see an element. What am I missing?
Thank you!