
key 이벤트
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<input
type="text"
onkeypress="myFunction(event)"
onkeydown="myFunction(event)"
onkeyup="myFunction(event)"
/>
<script>
function myFunction(e) {
console.log(e.type); // 이벤트 이름 출력
console.log(e.target); // 이벤트를 발생시킨 DOM Element(요소)
console.log(e.target.value); // 이벤트가 일어나는 시점에 입력된 값이 어떻게 변하는지 출력
}
</script>
</body>
</html>

