Design comparison
Solution retrospective
Hi guys,
This project gave me real work to function.
Please give me feedback.
In the email field, the type in input tag I changed it to text, because I wasn't having the result I want, like the correct email format, and the red message example in the placeholder. So I change it from email to text, added a Javascript function to correct format and it worked. But I shouldn't do this right?
How can I achieve a better result without changing the type input?
Community feedback
- @astrageniusPosted almost 3 years ago
Hey ho :) Good solution so far. Your layout is really accurate.
For your question for the Email input:
- Set a "required" attribute and the "pattern" attribute and set an RegEx for Email validation in it. For example
<input type="email" id="email" placeholder="Email Address" pattern="/[\w\-\._]+@[\w\-\._]+\.\w{2,10}/" required>
You should set the 'label' html element to each input element.
For more Details:
for example
<label for="email"></label> <input type="email" id="email"> or <label for="email"> <input type="email" id="email"> </label>
Technical you don't need Javascript for clientsite formvalidation. You can it do only with CSS pseudo-classes.
For example
input:invalid { border: 2px dashed red; } input:invalid:required { background-color: red; } input:valid { border: 2px solid green; }
For more Details:
0 - Account deleted
Hi there 👋
Congratulate on finishing your project 🎉. The design looks beautiful 😃.
The email has the type of
email
because it helps the people who uses screen readers 👍. And also when you work with the backend it helps to get the email address easily. You can check if the email is all lowercase if not then show warn to put lowercase email 🍀Happy coding ☕
0
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