4
I have a script that does the toggle in the icon, interspersed when the element is clicked, my intention is when the second or the others icons were clicked, the elements remained with the class glyphicon-chevron-down
.
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
<i class="taskIcon glyphicon glyphicon-chevron-down"></i>
</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
<i class="taskIcon glyphicon glyphicon-chevron-down"></i>
</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
<i class="taskIcon glyphicon glyphicon-chevron-down"></i>
</a>
$(".taskIcon").on("click", function() {
$(this).toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
});
The code you put there only changes the clicked element.
– Oralista de Sistemas
if you click on the first icon, just once and then click on the second icon, the toggleclass that puts the glyphicon-chevron-up class, stays in the element, wanted to keep the glyphicon-chevron-down class for everyone after the toggle.
– Marcelo Batista