<div >
    <div class="child" ></div>
  </div>
    document.getElementById('parent').addEventListener('click',function(e){
      console.log(e)
      console.log(this.id + '被触发')

    },true);
    document.getElementById('child').addEventListener('click', function(e){
      console.log(e)
      console.log(this.id + '被触发')
    },true
    )

事件冒泡:4-7

事件捕获:1-4

事件冒泡,事件捕获和事件委托

https://www.cnblogs.com/Chen-XiaoJun/p/6210987.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-21
  • 2021-08-25
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案