HTML and CSS Reference
In-Depth Information
Requiring Data from the User
Requiring data from a user is relatively easy. It's just a matter of including the new
required
attribute on
the form field that you want the user to fill in, as you did on a number of the fields in your bookings form.
<input type="email" id="email" name="email" placeholder="e.g.
joe@example.com"
required
>
If the user fails to fill in a required form field, the browser will prevent the form from being submitted and will dis-
play a tip to the user as shown in Figure 7-2.
Figure 7-2
The tip displayed in Google Chrome if the user fails to fill in a required form field.