Changed the text and example names (#20918)
* Update index.md * Remove w3 link
This commit is contained in:
committed by
Niraj Nandish
parent
a3b5eda2c2
commit
cdb8d72db8
@ -4,11 +4,11 @@ title: Required
|
|||||||
## Required
|
## Required
|
||||||
|
|
||||||
|
|
||||||
The HTML required attribute is used in an input element to make the input field in a form required to submit the form.
|
The HTML `required` attribute is used in an input element to make the input field in a form required to submit the form. This means that the user must fill in the field. <br />
|
||||||
If the user does not fill in the input field the form will not submit and it will give a message asking the user to fill out the field.
|
If the user does not fill in the input field, the form will not submit and it will give a message asking the user to fill out the field. <br /> <br />
|
||||||
The `required` attribute is applicable to `<input>`, `<select>`, `<textarea>`.
|
The `required` attribute is applicable to `<input>`, `<select>`, and `<textarea>`.
|
||||||
|
|
||||||
For example:
|
`<input>` example:
|
||||||
```html
|
```html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -24,7 +24,7 @@ For example:
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
Select Example:
|
`<select>` Example:
|
||||||
```html
|
```html
|
||||||
<form action="/action.php">
|
<form action="/action.php">
|
||||||
<select required>
|
<select required>
|
||||||
@ -36,7 +36,7 @@ Select Example:
|
|||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
```
|
```
|
||||||
Text Area Example:
|
`<textarea>` Example:
|
||||||
```html
|
```html
|
||||||
<form action="/action.php">
|
<form action="/action.php">
|
||||||
<textarea name="comment" required></textarea>
|
<textarea name="comment" required></textarea>
|
||||||
@ -44,8 +44,6 @@ Text Area Example:
|
|||||||
</form>
|
</form>
|
||||||
```
|
```
|
||||||
|
|
||||||
Simply add `required` to an input element
|
|
||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input" target="_blank">MDN article on the input element</a>
|
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input" target="_blank">MDN article on the input element</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user