JQuery 提供了两种方式来阻止事件冒泡。

方式一:event.stopPropagation();

        $("#div1").mousedown(function(event){
            event.stopPropagation();
        });

方式二:return false;

        $("#div1").mousedown(function(event){
            return false;
        });
$("a").click(function(event){ event.preventDefault(); });

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-06-20
  • 2021-06-21
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2022-12-23
  • 2021-07-08
相关资源
相似解决方案