Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<title>Quote generator</title>
<script defer src="quotes.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>hello there</h1>
Expand Down
11 changes: 11 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
});
3 changes: 3 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/** Write your CSS in here **/
#author {
font-style: italic;
}