File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed
javascript/introduction-to-js-1/what-is-js Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 5
5
</ head >
6
6
< body >
7
7
< button > Click me</ button >
8
+
9
+ < script src ="script.js "> </ script >
8
10
</ body >
9
- < script src ="script.js "> </ script >
10
- </ html >
11
+ </ html >
Original file line number Diff line number Diff line change 5
5
</ head >
6
6
< body >
7
7
< button > Click me</ button >
8
- </ body >
9
- < script >
10
- function createParagraph ( ) {
11
- var para = document . createElement ( 'p' ) ;
12
- para . textContent = 'You clicked the button!' ;
13
- document . body . appendChild ( para ) ;
14
- }
15
8
16
- var buttons = document . querySelectorAll ( 'button' ) ;
9
+ < script >
10
+ function createParagraph ( ) {
11
+ var para = document . createElement ( 'p' ) ;
12
+ para . textContent = 'You clicked the button!' ;
13
+ document . body . appendChild ( para ) ;
14
+ }
15
+
16
+ var buttons = document . querySelectorAll ( 'button' ) ;
17
17
18
- for ( var i = 0 ; i < buttons . length ; i ++ ) {
19
- buttons [ i ] . addEventListener ( 'click' , createParagraph ) ;
20
- }
21
- </ script >
22
- </ html >
18
+ for ( var i = 0 ; i < buttons . length ; i ++ ) {
19
+ buttons [ i ] . addEventListener ( 'click' , createParagraph ) ;
20
+ }
21
+ </ script >
22
+ </ body >
23
+ </ html >
You can’t perform that action at this time.
0 commit comments