diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..88f32f473 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,11 +3,12 @@ - Title here + Quote generator app + -

hello there

+

Quote generator app

diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..ed4b895b6 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,16 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteEl = document.querySelector("#quote"); +const authorEl = document.querySelector("#author"); +const newQuoteButton = document.querySelector("#new-quote"); + +function showRandomQuote() { + const chosen = pickFromArray(quotes); + quoteEl.textContent = chosen.quote; + authorEl.textContent = chosen.author; +} + +showRandomQuote(); +newQuoteButton.addEventListener("click", showRandomQuote);