Skip to content

Commit a657abb

Browse files
committed
Fix quotes generator app
1 parent 9610268 commit a657abb

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Sprint-3/quote-generator/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Title here</title>
7-
<script defer src="quotes.js"></script>
6+
<title>Quote Generator App</A></title>
87
</head>
98
<body>
9+
<main>
10+
<section></section>
1011
<h1>hello there</h1>
1112
<p id="quote"></p>
1213
<p id="author"></p>
1314
<button type="button" id="new-quote">New quote</button>
15+
</section>
16+
</main>
17+
<script defer src="quotes.js"></script>
1418
</body>
1519
</html>

Sprint-3/quote-generator/quotes.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
const quoteElem = document.getElementById("quote");
2+
const authorElem = document.getElementById("author");
3+
const button = document.getElementById("new-quote");
4+
5+
function showNewQuote() {
6+
const random = pickFromArray(quotes);
7+
quoteElem.textContent = random.quote;
8+
authorElem.textContent = random.author;
9+
}
10+
11+
window.addEventListener("DOMContentLoaded", () => {
12+
showNewQuote();
13+
14+
button.addEventListener("click", showNewQuote);
15+
});
16+
117
// DO NOT EDIT BELOW HERE
218

319
// pickFromArray is a function which will return one item, at

0 commit comments

Comments
 (0)