JAVA全系列 教程
3762个小节阅读:7093.9k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
选择器
DOM操作
CSS操作
事件处理
遍历
动画
添加键盘按下事件
xxxxxxxxxx
<!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>
<script src="./js/jquery-3.6.0.min.js"></script>
</head>
<body>
<input type="text" class="username">
<script>
$(".username").keydown(function(){
console.log("键盘");
})
</script>
</body>
</html>
添加键盘事件
xxxxxxxxxx
<!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>
<script src="./js/jquery-3.6.0.min.js"></script>
</head>
<body>
<input type="text" class="username">
<script>
$(".username").keypress(function(){
console.log("键盘");
})
</script>
</body>
</html>
添加键盘抬起事件
xxxxxxxxxx
<!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>
<script src="./js/jquery-3.6.0.min.js"></script>
</head>
<body>
<input type="text" class="username">
<script>
$(".username").keyup(function(){
console.log("键盘");
})
</script>
</body>
</html>
实时效果反馈
1. 下列哪个是键盘按键抬起触发的事件:
A keydown()
B keypress()
C keyup()
D click()
答案
1=>C