<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery.js"></script>
</head>
<body>
<div id="div"></div>
<script>
$('#div').on('hello',function(){
console.log('abc事件发生了')
});
$('#div').trigger('hello');
//自定义事件
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery.js"></script>
</head>
<body>
<div id="div"></div>
<script>
$('#div').on('hello',function(){
console.log('abc事件发生了')
});
$('#div').trigger('hello');
//自定义事件
</script>
</body>
</html>