A few simple form attributes can have the same effect as reams of Java Script code libraries.
Here we have an enhanced version of the above code where we've added HTML5 handler to the first password field which updates the pattern required by the second password field - in effect forcing them to be identical: Here you can see a screen shot from Safari of the form being completed.
The password won't appear on the screen as you type and most browsers also won't 'remember' the values entered in fields as they do with other form elements.
Remember that, as Java Script isn't available in all browsers, you should also use server-side scripting to validate all data before recording it in a database or elsewhere.
You might also want to spice up your forms using HTML5 Form Validation as we've done further down the page.
They can be used not just in Java Script, but also PHP, Perl, Java and many other languages.
Some text editors (not just vi) also allow them when searching for or replacing text. This is a new technique available in modern browsers and definitely the way of the future.
Otherwise your application needs to provide this function.