File tree 6 files changed +18
-71
lines changed
6 files changed +18
-71
lines changed Original file line number Diff line number Diff line change 11
11
</ style >
12
12
</ head >
13
13
< body >
14
- < footer >
15
-
14
+ < footer >
16
15
</ footer >
17
16
< script >
18
- const pageFooter = document . querySelector ( "footer' );
17
+ const pageFooter - document . querySelector ( "footer" ) ;
19
18
</ script >
20
19
</ body >
21
20
</ html >
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="utf-8 ">
5
- < title > Setting the focus</ title >
5
+ < title > Monitoring the focus event </ title >
6
6
< style >
7
7
* {
8
8
margin : 0 ;
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="utf-8 ">
5
- < title > Handling and Triggering Form Events </ title >
5
+ < title > Monitoring the blur event </ title >
6
6
< style >
7
7
* {
8
8
margin : 0 ;
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="utf-8 ">
5
- < title > Handling and Triggering Form Events </ title >
5
+ < title > Listening for element changes </ title >
6
6
< style >
7
7
* {
8
8
margin : 0 ;
24
24
< input id ="bgcolor " type ="color " name ="bg-color " value ="#ffffff ">
25
25
</ form >
26
26
< script >
27
- document . querySelector ( '#bgcolor' ) . addEventListener ( 'change' , function ( ) {
28
- let backgroundColor = this . value ;
27
+ document . querySelector ( '#bgcolor' ) . addEventListener ( 'change' , ( event ) => {
28
+ let backgroundColor = event . target . value ;
29
29
document . body . bgColor = backgroundColor ;
30
30
} ) ;
31
31
</ script >
Original file line number Diff line number Diff line change 26
26
</ style >
27
27
</ head >
28
28
< body >
29
- < button >
30
- Run Me!
31
- </ button >
29
+ < form >
30
+ < button type ="button ">
31
+ Run Me!
32
+ </ button >
33
+ </ form >
32
34
< p >
33
- Keyboard shortcut: Ctrl+Shift+B
35
+ Keyboard shortcut: Ctrl+Shift+E
34
36
</ p >
35
37
< script >
36
38
// Add a listener for the button's 'click' event
37
39
document
38
40
. querySelector ( 'button' )
39
41
. addEventListener ( 'click' ,
40
- function ( ) {
42
+ ( event ) => {
41
43
// Change the button text
42
- this . innerText = 'Thanks!' ;
44
+ event . target . innerText = 'Thanks!' ;
43
45
44
46
// Reset the button after 3 seconds
45
47
setTimeout ( ( ) => document
51
53
// Add a listener for the 'keydown' event
52
54
document
53
55
. addEventListener ( 'keydown' ,
54
- function ( e ) {
55
- // Check to see if Ctrl+Shift+B are all pressed
56
- if ( e . ctrlKey && e . shiftKey && e . key === 'B ' ) {
56
+ function ( event ) {
57
+ // Check whether Ctrl+Shift+E are all pressed
58
+ if ( event . ctrlKey && event . shiftKey && event . key === 'E ' ) {
57
59
// If so, trigger the button's 'click' event
58
60
document . querySelector ( 'button' ) . click ( ) ;
59
61
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments