📜  如何防止在 javascript 代码示例中捕获事件

📅  最后修改于: 2022-03-11 15:02:37.089000             🧑  作者: Mango

代码示例1
how to prevent event button click capturing to tag/div/icon
easiest way OPTION 1 with CSS:
button > * {
  pointer-events: none;
}

OPTION 2 with javascript:
use e.currentTarget.children ;

OPTION 3 with Javascript:
use e.target.closest('selector') to locate the child, not e.currentTarget;