1
I have the following code HTML
:
<div id="mini-cart" class="mini-cart dropdown is-not-empty">
<span class="ic-cart"></span>
<span class="count-cart" style="display:none;"><br><br></span>
<strong class="minhaCart">minha <span class="compraCart">COMPRA</span></strong>
<span class="caret-cart"></span><br>
<div id="header-cart" class="mini-cart-content dropdown-content left-hand skip-content skip-content- -style block-cart block" style="display: none;">
<span class="msg-carrinho-vazio"> Seu carrinho está vazio :( </span>
</div>
</div>
And the following code jQuery
:
$j('#mini-cart').not('#header-cart').on('click',function(){
alert('Teste');
});
What I wanted to do was when the div
with the id="mini-cart"
were clicked, the alert
is shown, however, if the div
with the id="header-cart"
that is inside it is clicked, the alert
cannot be displayed.
your selector is meaningless, you are saying "select the element with id mini-cart that nay be the id header-Cart" will not work. Need to make a selector for each element with its respective ID
– Ricardo Pontual
@Ricardopunctual What I wanted to do was "select the element with id
mini-cart
minus the element with idheader-cart
", because the same is inside thediv
, but if it is clicked, it should not givealert
some.– Matheus Portela