The input required attribute specifies that an input field must be filled out before submitting the form.
The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.
<!DOCTYPE html>
<html>
<body>
<h1>The input required attribute</h1>
<p>The required attribute specifies that an input field must be filled out before submitting the form.</p>
<form method="post" action="/php/actionPagePost.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" placeholder="First Name" required><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" placeholder="Last Name" required><br><br>
<input type="submit" value="Submit">
</form>
<p><strong>Note:</strong> The required attribute of the input tag is not supported in Safari prior version 10.1.</p>
</body>
</html>