This project demonstrates how to perform form validation using JavaScript. It includes an HTML form with various input fields such as text, email, password, and checkboxes, along with corresponding validation rules.
Live preview: https://jagjeet-dhuna.github.io/JavaScript-FormValidation/
- Validates the form inputs in real-time as the user interacts with the form.
- Provides immediate feedback to the user by highlighting invalid fields and displaying error messages.
- Implements validation rules for different types of fields, including required fields, email format, password strength, and checkbox selection.
- Utilizes JavaScript to handle form submission, preventing it if any of the fields are invalid.
- Separates the presentation logic from the validation logic by using CSS to style the form and error messages.
- Clone or download the project repository.
- Open the
index.htmlfile in a web browser. - Fill in the form fields and observe the validation in action.
- Try submitting the form with invalid input to see the error messages.
index.html: The HTML file containing the form structure and input fields.styles.css: The CSS file that defines the styles for the form and error messages.script.js: The JavaScript file responsible for implementing the form validation logic.
