← BYTES
HTML·Intermediate·Ref: 2.2.19
What does the `pattern` attribute on a text `<input>` element do?
Have a question about this video? Mention reference 2.2.19 when you contact us.
a.It specifies a regular expression the input's value must match for the form to be considered valid, triggering the browser's native validation UI if it doesn't
b.It sets a decorative background pattern image on the input
c.It restricts the input to numeric characters only
d.It defines the input's placeholder text format
pattern="[0-9]{5}" on an input requires the entered value to match that regex (here, exactly 5 digits) before the form will submit, with the browser showing its built-in validation message if it doesn't -- a client-side, JavaScript-free way to enforce a specific text format, though server-side validation is still required since client-side checks can always be bypassed.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES2219#HTML