-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathevents1.html
39 lines (39 loc) · 985 Bytes
/
events1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Events example #1</title>
<style>
div {
width: 100px;
height: 100px;
border: 1px solid grey;
margin: 10px;
}
#red {
background-color: red;
}
#blue {
background-color: blue;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("div").click(function () {
alert("Clicked a square!");
});
$("#red").mouseenter(function (){
console.log("You entered the red square!");
});
$("#red").mouseleave(function (){
console.log("You left the red square!");
});
});
</script>
</head>
<body>
<div id="red"></div>
<div id="blue"></div>
</body>
</html>