Ever want to quickly and easily confirm that a user has entered the same password in the Password and Confirmation fields? Get The Elements First, we assign the document object for each of the password fields and the confirmation message into variables.
Most of the methods use regular expressions to test the password, which means altering a requirement or adding a new one could be done easily.
The first thing we’ll do is create an immediately-invoked function expression (IFFE).
The name might sound overly-complex, but it’s really just a way of isolating any variables that we create to this specific scope and keep them out of the global namespace.
Here is a fairly common set of requirements when setting a password: Unfortunately, all these restrictions can put a bit of a damper on the user experience.
This is especially true if the user is not warned about the requirements before submitting a form.