delegate icon indicating copy to clipboard operation
delegate copied to clipboard

e.stopPropogation not work

Open mihrich opened this issue 5 years ago • 1 comments

Hello! Thanks a lot for module!

I have code how:

delegate('.container', '.item', 'click', (e) => {
 // some actions
});

delegate('.container', '.link', 'click', (e) => {
   e.preventDefault();
   e.stopPropagation();
  // some actions
});

And html:

<div class="container">
  <div class="item">
    <a href="#"  class="link">click 1</a>
  </div>
  <div  class="item">
    <a href="#" class="link">click 2</a>
  </div>
  <div class="item">
    <a href="#" class="link">click 3</a>
  </div>
</div>

And when I click on the link the parent clickItem function fires

mihrich avatar Sep 13 '20 12:09 mihrich

Hello! Thanks a lot for module!

I have code how:

delegate('.container', '.item', 'click', (e) => {
 // some actions
});

delegate('.container', '.link', 'click', (e) => {
   e.preventDefault();
   e.stopPropagation();
  // some actions
});

And html:

<div class="container">
  <div class="item">
    <a href="#"  class="link">click 1</a>
  </div>
  <div  class="item">
    <a href="#" class="link">click 2</a>
  </div>
  <div class="item">
    <a href="#" class="link">click 3</a>
  </div>
</div>

And when I click on the link the parent clickItem function fires

I know that jquery will not have this problem. Have you solved this problem? I prefer to use javascript to solve this problem

ajiho avatar Feb 27 '23 14:02 ajiho