File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Title here</ title >
7- < script defer src ="quotes.js "> </ script >
6+ < title > Quote Generator App</ A > </ title >
87 </ head >
98 < body >
9+ < main >
10+ < section > </ section >
1011 < h1 > hello there</ h1 >
1112 < p id ="quote "> </ p >
1213 < p id ="author "> </ p >
1314 < button type ="button " id ="new-quote "> New quote</ button >
15+ </ section >
16+ </ main >
17+ < script defer src ="quotes.js "> </ script >
1418 </ body >
1519</ html >
Original file line number Diff line number Diff line change 1+ const quoteElem = document . getElementById ( "quote" ) ;
2+ const authorElem = document . getElementById ( "author" ) ;
3+ const button = document . getElementById ( "new-quote" ) ;
4+
5+ function showNewQuote ( ) {
6+ const random = pickFromArray ( quotes ) ;
7+ quoteElem . textContent = random . quote ;
8+ authorElem . textContent = random . author ;
9+ }
10+
11+ window . addEventListener ( "DOMContentLoaded" , ( ) => {
12+ showNewQuote ( ) ;
13+
14+ button . addEventListener ( "click" , showNewQuote ) ;
15+ } ) ;
16+
117// DO NOT EDIT BELOW HERE
218
319// pickFromArray is a function which will return one item, at
You can’t perform that action at this time.
0 commit comments