fix(curriculum): add an example for the "required" attribute (#58993)

This commit is contained in:
zxc-w
2025-02-26 11:19:45 -05:00
committed by GitHub
parent 48df556ed7
commit ab3cbbe980
@@ -7,7 +7,15 @@ dashedName: step-43
# --description--
To prevent a user from submitting your form when required information is missing, you need to add the `required` attribute to an `input` element. There's no need to set a value to the `required` attribute. Instead, just add the word `required` to the `input` element, making sure there is space between it and other attributes.
To prevent a user from submitting your form when required information is missing, you need to add the `required` attribute to an `input` element.
Here is an example of an input field with the `required` attribute:
```html
<input type="text" name="firstName" required>
```
There's no need to set a value to the `required` attribute. Instead, just add the word `required` to the `input` element, making sure there is space between it and other attributes.
# --hints--