diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..b1090d6dc 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Title here + Quote Generator app diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..4821b517d 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.getElementById("quote"); +const authorEl = document.getElementById("author"); +const newQuoteButton = document.getElementById("new-quote"); + +function showRandomQuote() { + const selected = pickFromArray(quotes); + quoteEl.textContent = selected.quote; + authorEl.textContent = selected.author; +} + +showRandomQuote(); + +newQuoteButton.addEventListener("click", showRandomQuote);