File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
66 < title > Quote generator app</ title >
77 < script defer src ="quotes.js "> </ script >
8- < link rel ="stylesheet " href ="style.css ">
8+ < link rel ="stylesheet " href ="style.css " / >
99 </ head >
1010 < body >
1111 < div class ="page ">
1212 < main class ="quote-card ">
1313 < figure class ="quote ">
1414 < span class ="quote-mark "> ❝</ span >
15- < blockquote id ="quote-text ">
16- Don't cry because it's over, smile because it happened.
17- </ blockquote >
18- < figcaption id ="quote-author "> – Dr. Seuss</ figcaption >
15+ < blockquote id ="quote-text "> </ blockquote >
16+ < figcaption id ="quote-author "> </ figcaption >
1917 </ figure >
20-
21- < button id ="new-quote-btn " type ="button ">
22- New quote
23- </ button >
18+
19+ < button id ="new-quote-btn " type ="button "> New quote</ button >
2420 </ main >
2521 </ div >
2622 </ body >
Original file line number Diff line number Diff line change @@ -491,3 +491,10 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+ function generateRandomQuote ( ) {
495+ const myObj = pickFromArray ( quotes ) ;
496+ document . getElementById ( "quote-text" ) . textContent = `${ myObj . quote } `
497+ document . getElementById ( "quote-author" ) . textContent = `-${ myObj . author } `
498+ }
499+ window . onload = generateRandomQuote ;
500+ document . getElementById ( "new-quote-btn" ) . addEventListener ( "click" , generateRandomQuote ) ;
You can’t perform that action at this time.
0 commit comments