Intro-component-with-signup-form using HTML and CSS
Design comparison
Solution retrospective
As I'm new to javavscript....I don't know how to make form validation using javascript....so I have used <form> tag required attribute make this sign-in form....Give me some suggestions about how to do form validation using javascript...Though I didn't face any problem , but if I had made made any mistake feel free to point it out....and I'd be grateful if you can give me some feedbacks to improve 🙏
Community feedback
- @rehberbeyPosted about 2 years ago
Looks great! 🎀
-
With HTML, you can already validate the form on the client side. You can use attributes like pattern and accept. I suggest you look at input attributes.
-
You can use the :invalid pseudo-class to change the style of the element when the wrong input is entered.
-
After that, it will be to submit the form to the server.
-
If you still want to authenticate with javascript on the client side, you can read this. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#client-side_validation
<form action="" method="post"> <label for="name">Name:</label> <input type="text" name="name" id="name" required pattern="[a-zA-Z]+" placeholder="John" /> <input type="submit" /> </form>
input:invalid { border: 2px solid red; }
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