我有一个项目,需要添加一个注册表单。我希望能够在不点击注册按钮的情况下验证密码和确认密码是否相同。
如果密码和确认密码字段不匹配,则我还想在确认密码字段旁边放置一个错误消息并禁用注册按钮。
以下是我的HTML代码...
<form id="form" name="form" method="post" action="registration.php">
<label >username :
<input name="username" id="username" type="text" /></label> <br>
<label >password :
<input name="password" id="password" type="password" /></label>
<label>confirm password:
<input type="password" name="confirm_password" id="confirm_password" />
</label>
<label>
<input type="submit" name="submit" value="registration" />
</label>
有没有任何方法可以做到这一点?