Design comparison
SolutionDesign
Solution retrospective
that was definitely the hardest challenge for me. Need some tips for getting more productiv and for solve challenges like this easier. NEED lot of advices and tips in JavaScript!
Community feedback
- @vanzasetiaPosted over 1 year ago
Hello, Enis67! π
Here are some suggestions to improve your JavaScript:
- Avoid using
var
. Useconst
orlet
instead. - Avoid using JavaScript to add styling (unless you have no other option). JavaScript allows you to change the CSS code using the
style
property. But, to make debugging easier and improve code maintainability, itβs best to avoid it. Use CSS classes instead. - Use
js-
classes to grab elements within JavaScript. - Use regular expression to validate the email address.
Next, some suggestions for the form validation:
- Each input element must have an accessible name. In this case, you can use
aria-label
attribute to provide an accessible name for each input. - Each of the
<p>
elements for the error messages should be programmatically connected with the associated<input>
element. You can do that by usingaria-describedby
attribute. - Also, each of the error messages should be a live region. You should use
aria-live
attribute. This way, screen readers will pronounce the error as soon as the region gets populated with the message through JavaScript. - Make sure the
<p>
for the error messages should be empty initially. - Learn more β How To Create Accessible Form with Simple Design? β Vanza Setia
I hope this helps. Happy coding! π
0 - Avoid using
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