I'm using .toggleClass
to hide/show a div on my website, and it works as I want it, but only when I click on the div itself and not on its child elements (three span) so I have to click just on the div itself, but what I don't get is why it detects the click but does not execute the toggleClass
when clicking on these spans ?
Html :
<div class="ClicLog Login" id="BoutonLogin">
<span class="ico-Login"></span>
<span class="noMobile" id="boutonConnectText">MON COMPTE</span>
<span class="ico-Menu"></span>
</div>
Javascript :
$('.ClicLog').click(function () {
console.log("clic !");
$('.nocollapse').toggleClass('LoginTest');
});
Thanks !
Ok, I found the problem : there was a javascript that closed the div I wanted to open when clicking somewhere else than the div only, so clicking on the spans opened and closed the div instantly... I thought I checked it before but apparently not. Thanks all of you for your help !