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

This commit is contained in:
zxc-w 2025-02-26 18:19:45 +02:00 committed by GitHub
parent 48df556ed7
commit ab3cbbe980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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--