Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery click on li item but NOT a class in it
    text
    copied!<p>I have this cart that has many items, everyone of this is a <code>&lt;li&gt;</code> element set thru PHP:</p> <pre><code>&lt;li class="cart-product" data-id="&lt;?= $product-&gt;id ?&gt;" data-rowid="" data-ison="0"&gt; &lt;span class="product-lightup"&gt;&lt;img src="&lt;?= base_url('img/site_basics/product_lightup.png') ?&gt;" /&gt;&lt;/span&gt; &lt;img src="&lt;?= base_url('img/products/'.$product-&gt;image) ?&gt;" class="product-img"/&gt; &lt;!-- PLUS/MINUS --&gt; &lt;div class="text-center product-click"&gt;&lt;br&gt; &lt;span class="cart-plus"&gt;&lt;img src="&lt;?= base_url('img/site_basics/plus_sign.png') ?&gt;" /&gt;&lt;br&gt;Aggiungi&lt;/span&gt; &lt;span class="cart-minus"&gt;&lt;img src="&lt;?= base_url('img/site_basics/minus_sign.png') ?&gt;" /&gt;&lt;br&gt;Rimuovi&lt;/span&gt; &lt;/div&gt; &lt;!-- Findout button --&gt; &lt;div class="text-center product-findout"&gt; &lt;span class="badge"&gt;Scopri più&lt;/span&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>I use this jQuery to select an item:</p> <pre><code>$('.cart-product').click(function(){ if($(this).attr('data-ison') === '1'){ $(this).itemOff(); }else{ $(this).itemOn(); } }); </code></pre> <p>I want to remove the click event from the <code>li &gt; div.product-findout</code>.<br> I tried changing the evet this way but doesn't work:</p> <pre><code>$('.cart-product:not(.product-findout)').click(function(){ [...] }); </code></pre> <p><em><strong>[Edit]</em></strong> The code classes and sub-classes are important to be kept the same, as the jQuery gets and sets attribute to it. I need to make the <code>li</code> item clickable AND GIVE THE <code>.product-findout</code> another link/event.<br>Any other way or idea?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload