Ping Coming Soon page using Tailwind-css

Solution retrospective
Any suggestions on optimizing the JavaScript code?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @saurabhgithb
Hello Shiva, I think your code can be optimized as:- a) remove separate markup for each error message instead set error message in js using a setError function. b) pass the message in setError function and use it to add innerText and styles for different error in js. c) make the div containing error message absolute and position it correctly. You can use the same for success message also. This will save use hide/unhide logic.
Marked as helpful - @icaroMendes777
In general looks good. But if you wanna some sugestions:
-
the standard validation to input email is over the red message suggested in the design, you can change the input type from email to text, so this validation wont be triggered
-
the if statement
if (emailInput.value === "" || emailInput.value === null)
can be stated justif(!emailInput.value )
but, yeah, there is not much to say. I think it is good.
Marked as helpful -
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