html5 中需要属性

Require attribute in html5

在 html5 中有一个必需的属性,我已经在我的代码中使用了它,但即使我将该字段留空它也没有说 "This field is required"。请任何人回答为什么我没有收到说消息的弹出框。以下是我的代码:

<form id="contact" method="post">
<label for="firstName">First Name:</label><br>
<input type="text" name="firstName" placeholder="First Name" required><br>
<label for="lastName">Last Name:</label><br>
<input type="text" name="lastName" placeholder="Last Name"><br>
<label for="email">Email:</label><br>
<input type="email" name="email" placeholder="Email"><br>
<label for="password">Password:</label><br>
<input type="password" name="password" placeholder="Password"><br>
<input type="button" name="submit" value="Submit">
</form>

更改提交按钮

<form id="contact" method="post">
<label for="firstName">First Name:</label><br>
<input type="text" name="firstName" placeholder="First Name" required><br>
<label for="lastName">Last Name:</label><br>
<input type="text" name="lastName" placeholder="Last Name"><br>
<label for="email">Email:</label><br>
<input type="email" name="email" placeholder="Email"><br>
<label for="password">Password:</label><br>
<input type="password" name="password" placeholder="Password"><br>
<input type="submit" name="submit" value="Submit">
</form>