So, I have multiple div with the same class class="galao" and all of them have a p tag with the same class class="nomeGalao" as well. I'm trying to use a e.target in order to trigger a mouseover event and change the class of that especific p tag (div's child).
Here is my code
$(document).on({
mouseenter: function() {
e = e || window.event;
var target = e.target || e.srcElement;
$(target).children().addClass('invisible');
},
mouseleave: function() {
e = e || window.event;
var target = e.target || e.srcElement;
$(target).children().addClass('invisible');
}
}, ".galao");
.invisible {
visibility: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="" class="galao">
<div class="informacoesGalao">
<div class="tabelaInformacoes infoGalao" style="float:right; text-align:right">
<p class="invisible nomeGalao">Produto A</p>
</div>
</div>
</div>
<div id="" class="galao">
<div class="informacoesGalao">
<div class="tabelaInformacoes infoGalao" style="float:right; text-align:right">
<p class="invisible nomeGalao">Produto B</p>
</div>
</div>
</div>
The problem is that I'm getting a undefined e, even when I'e already used a e.target in another function.