diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..b596c0e75 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,13 +1,45 @@ - + - Title here + Quote Generator App + -

hello there

+

Welcome to the Quote Generator

diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..bf1220def 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,20 @@ +// DO NOT EDIT ABOVE HERE +window.addEventListener("DOMContentLoaded", () => { + const quoteElement = document.getElementById("quote"); + const authorElement = document.getElementById("author"); + const newQuoteBtn = document.getElementById("new-quote"); + + function displayRandomQuote() { + const randomQuote = pickFromArray(quotes); + quoteElement.textContent = `"${randomQuote.quote}"`; + authorElement.textContent = randomQuote.author; + } + + displayRandomQuote(); + + newQuoteBtn.addEventListener("click", displayRandomQuote); +}); + // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at