<!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>Title</title>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<style>
</style>
</head>
<body>
<div>
<label>
<input type="text" id="input1" >
<input type="text" id="input2" >
<input type="text" id="input3" >
</label>
</div>
</body>
<script>
$("#input1").on("keydown",(e)=>{
console.log(`keydown====>${e.keyCode}`);
//지금 누른 키의 아스키코드를 가져온다.
if(parseInt(`${e.keyCode}`)===13){
console.log('시부럴');
}
});
$("#input2").on("keypress",(e)=>{
console.log(`keypress====>${e.keyCode}`);
//지금 누른 키의 아스키코드를 가져온다.
})
///키다운은 대문자 소문자 구분 못함
//키프레스는 대문자 소문자 구분을함
</script>
</html>
댓글 영역