クリックイベント(または伝播)を別の要素から一時的に無効にする方法を決定しようとしています。 特定の要素のイベントでmousedownをクリックすると、別の要素のクリックイベントが発生しなくなりました。異なる要素の伝搬を停止する
Simplified Example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div id="World">World</div>
<div id="Hello">Hello</div>
<script>
$(document).mousedown(function (e){
if($('.there').length){
$('.there').remove();
console.log('removed there');
//here is where I would need the '#World' click event to not fire
}
});
$(document).on('click','#World',function(){
console.log('World');
});
$(document).on('click','#Hello',function(){
console.log('Hello');
$(this).append('<div class="there">there</div>');
console.log('added there');
});
</script>