Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

advice generator app main

Ehsan 210

@Ehsan-eslami

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


This is the Advice-generator-app challenge from Front-end mentor challenges. This app doesn't work on Firefox. I don't know why, but I thought it would be better to mention this problem.

I would appreciate it if you could tell me how to make the code better.

Community feedback

@stadnik-petro

Posted

Hello!

It seems like there might be some issues with Firefox due to the click handler being invoked before registering in addEventListener(). Here's how you can fix it:


adviceBtn.addEventListener("click", getAdvice);
getAdvice();

Another aspect I want to draw your attention to is handling clicks on the img tag instead of <div class="dice-img">. This may lead to a situation where the user isn't clicking directly on the image, and the code won't work. I recommend paying attention to this point!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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