From 1f8d1d12fb0da943275c09a410135495838ae414 Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 27 Feb 2026 10:27:35 +0000 Subject: [PATCH 1/2] implement quote generator --- Sprint-3/quote-generator/index.html | 5 +++-- Sprint-3/quote-generator/quotes.js | 11 +++++++++++ Sprint-3/quote-generator/style.css | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..fe554a7e3 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,10 +1,11 @@ - + - Title here + Quote generator +

hello there

diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..de6103751 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,14 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteText = document.getElementById("quote"); +const authorText = document.getElementById("author"); + +const newQuoteBtn = document.getElementById("new-quote"); + +newQuoteBtn.addEventListener("click", () => { + const selectedQuote = pickFromArray(quotes); + quoteText.textContent = selectedQuote.quote; + authorText.textContent = `-- ${selectedQuote.author}`; +}); diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..b58fd4785 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,4 @@ /** Write your CSS in here **/ +#author { + font-style: italic; +} From 113093223609cd296958571d90e631e52c67d53d Mon Sep 17 00:00:00 2001 From: Raihan Sharif Date: Fri, 8 May 2026 01:44:00 +0100 Subject: [PATCH 2/2] fix: generate quote on page load, not just on button click. --- Sprint-3/quote-generator/quotes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index de6103751..69c8e1dce 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -502,3 +502,5 @@ newQuoteBtn.addEventListener("click", () => { quoteText.textContent = selectedQuote.quote; authorText.textContent = `-- ${selectedQuote.author}`; }); + +document.onload = newQuoteBtn.click();