gpt4 book ai didi

html 5 验证密码和确认密码

转载 作者:行者123 更新时间:2023-12-05 01:46:57 25 4
gpt4 key购买 nike

如何使用 html 5 在注册表单中验证密码和确认密码?我知道如何使用 java 脚本和 jquery。但我是 html5 的新手,所以想使用它。

        <input type="password" placeholder="Password" name="password" id='password1' required>
<input type="password" placeholder="Confirm Password" name="confirm_password" id="password2" required>

最佳答案

你可以试试这个

<input id="password" name="password" type="password" pattern="^\S{6,}$" onchange="this.setCustomValidity(this.validity.patternMismatch ? 'Must have at least 6 characters' : ''); if(this.checkValidity()) form.password_two.pattern = this.value;" placeholder="Password" required>

<input id="password_two" name="password_two" type="password" pattern="^\S{6,}$" onchange="this.setCustomValidity(this.validity.patternMismatch ? 'Please enter the same Password as above' : '');" placeholder="Verify Password" required>

关于html 5 验证密码和确认密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33231237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com