Design comparison
Community feedback
- @KrishnaVishwakarma1595Posted about 1 year ago
Hi, @IbsonBarboza
I went through your live site and code. On button click it actually throws a reference error that you function
pag2click
is not defined. You can check that on developer console on button click.Uncaught ReferenceError: pag2click is not defined at HTMLButtonElement.onclick (interactive-rating/:40:54)
What you can do is either add your external js file inside head tag or if you are intend to keep the JS in external file than to would be nice to handle click using eventlisteners.
For example -
document.addEventListener('DOMContentLoaded', function() { var button = document.getElementById('myButton'); button.addEventListener('click', myFunction); }); or var button = document.getElementById('<YOUR_BUTTON_ID>'); // Add a click event listener to the button button.addEventListener('click', function() { myFunction(); // Call the function when the button is clicked });
Reference link - Eventlistener in Javascript
Hope this will be helpful. Solutions look great! Good job!
Marked as helpful1@IbsonBarbozaPosted about 1 year ago@KrishnaVishwakarma1595 Thank you very much for the feedback, it helped me a lot I'm still having some trouble understanding how Event Listener work but over time I'll hope get the hang of it.
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