File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1- <!DOCTYPE html>
1+ <!doctype html>
22< html lang ="en ">
33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Title here</ title >
6+ < title > Quote generator app</ title >
7+ < link rel ="icon " href ="" />
8+ < link rel ="stylesheet " href ="./style.css " />
79 < script defer src ="quotes.js "> </ script >
810 </ head >
911 < body >
10- < h1 > hello there</ h1 >
1112 < p id ="quote "> </ p >
1213 < p id ="author "> </ p >
1314 < button type ="button " id ="new-quote "> New quote</ button >
Original file line number Diff line number Diff line change @@ -491,3 +491,16 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+
495+ function displayQuote ( ) {
496+ const randomQuote = pickFromArray ( quotes ) ;
497+ const quoteElement = document . getElementById ( "quote" ) ;
498+ const authorElement = document . getElementById ( "author" ) ;
499+
500+ quoteElement . textContent = randomQuote . quote ;
501+ authorElement . textContent = randomQuote . author ;
502+ }
503+
504+ displayQuote ( ) ;
505+
506+ document . getElementById ( "new-quote" ) . addEventListener ( "click" , displayQuote ) ;
You can’t perform that action at this time.
0 commit comments