Welcome to HTML Forms & Validation! 📝

Understanding Forms and Validation

Forms are used to collect input from users. HTML provides a variety of input types, and you can validate them to make sure the user provides the correct information.

Try It Yourself

Below is an example of a form with validation:

HTML Forms & Validation Quiz 🎯

1. What does the required attribute in an input field do?

Makes the field optional
Makes the field mandatory to fill
Makes the field read-only

2. What input type is used for a password field?

<input type="text">
<input type="password">
<input type="email">

3. What does the minlength attribute do?

Sets the maximum length of the input
Sets the minimum length of the input
Makes the input optional

4. Which input type is used for validating email?

<input type="email">
<input type="text">
<input type="password">

5. What attribute makes sure an input field contains only numbers?

pattern
min
type="number"