我有jquery停止傳播的問題。 要關閉車模式時,我除了在車模式在頁面上點擊,我不得不這樣做:事件停止與兒童事件傳播問題
$('html').click(function() {
$('.cart-block').css('display','none');
});
$('.mycart, .cart-block').click(function(event){
event.stopPropagation();
});
但我有一個問題,我有一個AJAX調用刪除我的車格內的項目(購物車塊),但停止傳播正在停止該事件。
$(document).on('click', '.deleteItem', function() {
//ajax call
});
有人可以幫助我嗎? 非常感謝 (對不起,我的英語)
編輯:HTML結構 //按鈕購物車
<div class="center cart mycart" >
//icon and cart item counter
</div>
<div id="cartcaption" class="cart-block">
//modal : content of the cart
<div class="productsPanier">
<span id="{{$cart->rowId}}" class="deleteItem">delete</span>
</div>
</div>
您能否展示您的HTML結構? – 4castle
是的,我更新了帖子,謝謝:) – Alexandre