这个是在网上找的资料
<div > <a >点我</a> <a >点我吧</a> <input ></input> <input ></input> </div> $("#parent *").click(function(e){ if(e.target == $("#a1")[0]){ alert("你点了链接一!"); }else if(e.target == $("#a2")[0]){ alert("你点了链接二!"); }else if(e.target == $("#b1")[0]){ alert("你点了按钮一!"); }else if(e.target == $("#b2")[0]){ alert("你点了按钮二!"); } }); 可以试试我这个,因为jQuery选择器的原因,所以一定要指定父级,否则会执行多次。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-23
相关资源
相似解决方案