Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dfaa0b8

Browse files
event bubbling in js
1 parent 98c7e63 commit dfaa0b8

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

‎Basic Introduction/index.html

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,9 @@
77
<title>Document</title>
88
</head>
99
<body>
10-
11-
<form action="">
12-
13-
Name <input type="text" id="myInput">
14-
</form>
15-
16-
17-
<script>
18-
19-
let x = document.getElementById('myInput');
20-
21-
x.addEventListener('focus' , myFocusFunction);
22-
x.addEventListener('blur' , myBlurFuction);
23-
x.addEventListener('input' , function(){
24-
console.log(this.value);
25-
})
26-
27-
function myFocusFunction(){
28-
x.style.background = 'yellow';
29-
}
30-
31-
function myBlurFuction(){
32-
x.style.background = 'white';
33-
}
34-
</script>
10+
11+
<div id="myDiv">
12+
13+
</div>
3514
</body>
3615
</html>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /