📌  相关文章
📜  在外部检查事件目标 jquery - Javascript 代码示例

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

代码示例1
$(document).on("click", function (event) {
  // If the target is not the container or a child of the container, then process
  // the click event for outside of the container.
  if ($(event.target).closest("#container").length === 0) {
    console.log("You clicked outside of the container element");
  }
});