CompareTo is a custom HTML5 attribute that compares two passwords with one another. If the passwords are not the same, a native error will be shown to the user:
You can see the demo here.
##Installation
- Download the minified script and reference it from your document; or,
- Reference the online minified script from your document. See the demo code if you need to.
##Usage
<form action="register" method="post">
<input type="text" name="username" required>
<input type="password" name="password" required>
<input type="password" name="compare_password" compareTo="password" required>
</form>
##Custom validity error message
<form action="register" method="post">
<input type="text" name="username" required>
<input type="password" name="password" required>
<input type="password" name="compare_password" compareTo="password" required>
<input type="email" name="email" required>
<input
type="email"
name="compare_email"
compareTo="email"
compareToError="emails do not match"
required>
</form>
##Support
Common problems will manifest in the developer console:
Still having trouble? Open an issue and someone will get back to you shortly 😄.