代码
提交代码
<form action="" method="post" novalidate><!--提交时不验证-->
<h2>提交时不验证</h2>
<h3>登录</h3>
<div>
<label for="user_name">用户名</label>
<input id="user_name" name="user_name" autofocus="" required=""><!-- 用户名表单 -->
</div>
<div>
<label for="password">密码</label>
<input id="password" name="password" type="password" autocomplete="off" value="" required=""><!--密码表单-->
</div>
<div>
<button type='submit'>登录</button>
</div>
</form>
<form action="" method="post"><!--提交时验证-->
<h2>提交时验证</h2>
<h3>登录</h3>
<div>
<label for="user_name">用户名</label>
<input id="user_name" name="user_name" autofocus="" required=""><!-- 用户名表单 -->
</div>
<div>
<label for="password">密码</label>
<input id="password" name="password" type="password" autocomplete="off" value="" required=""><!--密码表单-->
</div>
<div>
<button type='submit'>登录</button>
</div>
</form>
运行结果