15 lines
1.0 KiB
Markdown
15 lines
1.0 KiB
Markdown
|
---
|
||
|
title: Use HTML5 to Require a Field
|
||
|
---
|
||
|
## Use HTML5 to Require a Field
|
||
|
|
||
|
The `required` attribute works with almost all possible types of the `input` tag ( it doesn't works because it doesn't make sense for the buttons-like types or the ones with a default value e.g. `type=range`) and force the user to leave at least a minimum mark of the interaction with the required input when submitting ( select _at least_ one checkbox, type _at least_ one character into a text box, etc..)
|
||
|
|
||
|
Its use block the form form submission until the the `required` condition woudn't be fullfilled
|
||
|
|
||
|
You can use the `required` attribute with a particular syntax: since it is a boolean value you might write just`required` without any value.
|
||
|
|
||
|
In this challenge you already have a form and a input element: it asks you to add the `required` attribute to the input element; remember that if something of the original code is modified or removed by accident you can always restart with a clean code using the `reset all code` button.
|
||
|
|
||
|
Good luck!
|