diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..6ca6238ea 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,13 +3,21 @@ - Title here + + Quote generator app + + + -

hello there

-

-

- +
+

Quote Generator

+ +
+

+ + +
- + \ No newline at end of file diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..a3c3ab59b 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,20 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +function displayRandomQuote() { + const selectedQuote = pickFromArray(quotes); + + document.getElementById("quote").textContent = selectedQuote.quote; + document.getElementById("author").textContent = selectedQuote.author; +} + +function setup() { + const newQuoteButton = document.getElementById("new-quote"); + + newQuoteButton.addEventListener("click", displayRandomQuote); + + displayRandomQuote(); +} + +window.onload = setup;