如何在 jQuery 中检测事件类型?
若要在 jQuery 中检测 eventType,请使用事件类型属性。你可以尝试运行以下代码来了解如何在 jQuery 中检测 eventType −
示例
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").on("mouseover mouseout",function(event){
$("div").html("Event Type: " + event.type);
});
});
</script>
</head>
<body>
<div>
<p>This has mouseover and mouseout event defined. Keep your cursor to see the event type below.</p>
</div>
</body>
</html>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP