Responsive multi-page using grid and flex

Solution retrospective
It was a very interesting project, I am in the learning process of JS so the booking page was a struggle, I made a few pages to make it possible. Would appreciate any comment.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @savvystrider
Looks amazing!
Here are some suggestions to improve the JS:
-
Use
const
instead oflet
for variables that are not reassigned. -
Use
textContent
instead ofinnerHTML
since you're only setting text content. -
Use
input
event instead ofclick
event for input fields: Instead of attaching the click event to increase or decrease the number of visitors, you can attach the input event to thevisitorNumber
input field. This allows users to change the value by typing directly into the input field. -
Instead of
showDiv1()
,showDiv2()
, andshowDiv3()
, you could use more descriptive function names in camelCase, such asshowFamilyBooking()
,showSpecialBooking()
, andshowSocialBooking()
. -
Also, try to consolidate repeated code: The code that checks if a value is valid and shows or hides the label could be consolidated into a separate function that can be reused for each input field.
-
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