![]() |
Definition and UsageThe When present, it specifies that the element must be filled out before submitting the form. Applies toThe
Browser SupportThe |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The input required attribute</h1>
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<input type="submit">
</form>
</body>
</html>
Example:
HTML
<form action="/action_page.php">
<label for="cars">Choose a car:</label>
<select name="cars" id="cars" required>
<option value="">None</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<br><br>
<input type="submit" value="Submit">
</form>
Example:
HTML
<form action="/action_page.php">
<textarea rows="4" cols="50" name="comment" required>
</textarea>
<input type="submit">
</form>
html required attribute |
How to add An HTML form with a required input field - HTML required Attribute | HTML Attribute |
How to add An HTML form with a required drop-down list - HTML required Attribute | HTML Attribute |
How to add A form with a required text area - HTML required Attribute | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 39 |
Reffered: https://www.w3schools.com/tags/att_required.asp