Design comparison
SolutionDesign
Solution retrospective
Only thing lacking was the quotation marks. But learnt alot from this challlenge.
Community feedback
- @IryDevPosted over 1 year ago
Hey @KingLyrics, well done for your solution 😄
I have some advice in order to improve your solution :
- If you want your app to display advice when the page load you can call the function getQutoe
- Then when your page load you should see an advice instead of a lorem ipsum
JS :
const submitBtn = document.querySelector(".button"); const adviceId = document.getElementById('advice_id'); const advice = document.getElementById('advice') // api https://api.adviceslip.com/advice submitBtn.addEventListener("click", () => { getQutoe(); }); const getQutoe = () => { fetch("https://api.adviceslip.com/advice") .then((response) => response.json()) .then((quotes) => { adviceId.textContent = quotes.slip.id advice.textContent = quotes.slip.advice }) .catch(error =>{ console.log('Error fetching data:',error) }) }; getQuote()
I hope you'll find this helpful, BTW your solution is great 😄
Marked as helpful1@KingLyricsPosted over 1 year ago@IryDev Excellent observation! Thank you so much!
0@IryDevPosted over 1 year ago@KingLyrics Thank you! And no problem, don't hesitate to ask, if you have other questions
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord