📌  相关文章
📜  如何检查是否按下了输入 javascript 代码示例

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

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