css - jQuery click on li item but NOT a class in it -


i have cart has many items, of <li> element set thru php:

<li class="cart-product" data-id="<?= $product->id ?>" data-rowid="" data-ison="0">     <span class="product-lightup"><img src="<?= base_url('img/site_basics/product_lightup.png') ?>" /></span>     <img src="<?= base_url('img/products/'.$product->image) ?>" class="product-img"/>      <!-- plus/minus -->     <div class="text-center product-click"><br>         <span class="cart-plus"><img src="<?= base_url('img/site_basics/plus_sign.png') ?>" /><br>aggiungi</span>         <span class="cart-minus"><img src="<?= base_url('img/site_basics/minus_sign.png') ?>" /><br>rimuovi</span>     </div>      <!-- findout button -->     <div class="text-center product-findout">         <span class="badge">scopri piĆ¹</span>     </div> </li> 

i use jquery select item:

$('.cart-product').click(function(){     if($(this).attr('data-ison') === '1'){         $(this).itemoff();     }else{         $(this).itemon();     } }); 

i want remove click event li > div.product-findout.
tried changing evet way doesn't work:

$('.cart-product:not(.product-findout)').click(function(){     [...] }); 

[edit] code classes , sub-classes important kept same, jquery gets , sets attribute it. need make li item clickable , give .product-findout link/event.
any other way or idea?

you attaching click event items parent, because of event propagation everytime click of child items, event propagated parent:

$('.cart-product').click(function() {     alert("click"); });  $(".product-findout").click(function () {     return false; }); 

fiddle


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -