From 60476fef6cc7db463b55244ee367832ee55cc229 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Thu, 6 Aug 2026 19:33:39 +0100 Subject: [PATCH 1/2] Update title and structure of index.html --- Sprint-3/quote-generator/index.html | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..fdb8eb8f6 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

+ +
+

+ + +
From 9128df8ee209c09b9d68efab14e89e114dc8ca3e Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Thu, 6 Aug 2026 19:34:55 +0100 Subject: [PATCH 2/2] Add function to display random quotes --- Sprint-3/quote-generator/quotes.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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;