📜  javascript 检测输入时按下输入 - Javascript 代码示例

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

代码示例1
var el = document.getElementById("myInputID");
el.addEventListener("keydown", function(event) {
    if (event.key === "Enter") {
        // Enter key was hit
    }
});