I'm currently trying to customize the menu using the icon switcher, so when I click on one icon, it changes to a cross, and then when this cross is pressed, it goes back to the original. I got this far, but when I click on the new image, I need the old reset icon, and the cross should be applied to the new icon.
Here is how far I got:
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFive">
<a class="collapsed faq-links">
<i id="icon" class="fa fa-info-circle fa-3x"></i>
</a>
</div>
</div>
<br />
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading13">
<a class="collapsed faq-links">
<i id="icon" class="fa fa-heartbeat fa-3x"></i>
</a>
</div>
</div>
<br />
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFour">
<a class="collapsed faq-links" >
<i id="icon" class="fa fa-comments fa-3x"></i>
</a>
</div>
</div>
JavaScript:
$('.faq-links').click(function(){
var collapsed=$(this).find('i').hasClass('fa-info-circle');
$('.faq-links').find('i').removeClass('fa-times');
$('.faq-links').find('i').addClass('fa-info-circle');
if(collapsed)
$(this).find('i').toggleClass('fa-info-circle fa-3x fa-times fa-3x')
});
I installed JSFiddle to show that it works https://jsfiddle.net/BenjiBaird/yycf2jb8/1/
Therefore, when I click on the information circle, the cross is applied, and when I click on the other, this cross is deleted. How can I apply this to every icon.
Any help would be appreciated, hope I understood.