📜  js 事件目标 - Javascript 代码示例

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

代码示例1
const button = document.querySelector(".button");

button.addEventListener("click", function (evt) {
    // the event Target variable will contain the button element that we clicked on
    const eventTarget = evt.target;
    eventTarget.setAttribute("disabled", true);
});