Skip to content

Commit b18423a

Browse files
committed
copmlate the code
1 parent 664f5bd commit b18423a

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Sprint-3/quote-generator/index.html

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,18 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Quote generator app</title>
77
<script defer src="quotes.js"></script>
8-
<link rel="stylesheet" href="style.css">
8+
<link rel="stylesheet" href="style.css" />
99
</head>
1010
<body>
1111
<div class="page">
1212
<main class="quote-card">
1313
<figure class="quote">
1414
<span class="quote-mark"></span>
15-
<blockquote id="quote-text">
16-
Don't cry because it's over, smile because it happened.
17-
</blockquote>
18-
<figcaption id="quote-author">– Dr. Seuss</figcaption>
15+
<blockquote id="quote-text"></blockquote>
16+
<figcaption id="quote-author"></figcaption>
1917
</figure>
20-
21-
<button id="new-quote-btn" type="button">
22-
New quote
23-
</button>
18+
19+
<button id="new-quote-btn" type="button">New quote</button>
2420
</main>
2521
</div>
2622
</body>

Sprint-3/quote-generator/quotes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,10 @@ const quotes = [
491491
];
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
function generateRandomQuote(){
495+
const myObj =pickFromArray(quotes);
496+
document.getElementById("quote-text").textContent=`${myObj.quote}`
497+
document.getElementById("quote-author").textContent=`-${myObj.author}`
498+
}
499+
window.onload=generateRandomQuote;
500+
document.getElementById("new-quote-btn").addEventListener("click",generateRandomQuote);

0 commit comments

Comments
 (0)