Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Advice generator

bootstrap
caleb mokua•70
@calebomondi
A solution to the Advice generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I encountered a problem on where I placed my script and this affected whether my js function was called or not on button click. If I placed it in the head section, on button click the function was not called but if placed it immediately after the button element, the function is called successfully. In some other cases, for the function to be called, its vice versa. If anybody has a well understanding of JS, how does this come about ??

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on caleb mokua's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License