keyword event dom

 <!DOCTYPE html>

<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>replit</title>
  <link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<input placeholder="Move your character" >
<button>click me</button>
  <script src="index.js"></script>
</body>

</html>

-------------------------------------------------------------------

let inp = document.querySelector("input")

inp.addEventListener("keydown", function (){
    // console.log("key was pressed");
    console.log(event.Key);
    console.log(event.code);
})
// inp.addEventListener("keyup", function (){
//     console.log("key was release");
// })

Comments

Popular posts from this blog

practice test of Arithmetic Operations: