Design comparison
Solution retrospective
Is it the best solution to include js file in head of HTML ? Is the querySelector of JS a good way to access DOM element ? On an iPhone, my submit button seems to skip the padding. Do you know why ?
Community feedback
- @Kamasah-DicksonPosted over 2 years ago
Good job there your solution looks great and closer to the design.
- It is responsive on smaller devices but I suggest you reduce your cards background color's opacity to much the design's background.
- the querySelector can be used to select all the elements you want to select in the DOM in an array. eg if you want all the button on the page
But you need more practice and understanding before you get into that. But I suggest you use getElementById and getElementByClassName
- It is not advisable to have the JS in the head. If you want to use it in the head you must declare the defer attribute on it
script src="" defer script
But
It is a good practice to have the js above the end of the body.
---content--- script src script <\body>``` Besides hope this was helping👍 Happy coding👍💻Besides hope this was helping👍 Happy coding👍💻
Marked as helpful1@martinw0Posted over 2 years ago@Kamasah-Dickson Hello,
I've updated my solution with your advices. https://www.frontendmentor.io/solutions/responsive-interactive-rating-component-rJPo2EaUc There is a problem of opacity with the title. It can be fixed by overriding the opacity just for h1.
But, to be honest I found the querySelector easier to use forEach. What do you think ? Am I doing it well ?
Sincerely
0 - @DominykMcNamaraPosted over 2 years ago
It's my understanding that best practice is to include any javascript (including external javascript files) within a tag before the closing body tag of the HTML document. This allows the browser to load all HTML before loading any javascript. I hope this feedback helps you :)
Marked as helpful1
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