getButterfly Logo getButterfly code wrangling since 2005

Enforcing a strong password might be tricky, but using an automated jQuery process, you can offers users password generation on the registration form.


    <input type="text" name="password" id="password" placeholder="Password" value=""> 
    <a href="#" id="password-generate">Generate</a>

The jQuery:

$('#password-generate').click(function(e) {
    var password = (Math.random()*1e32).toString(36);


Note that I have used a text field for illustrative purposes. When creating a new account and generating a password, it is not necessary to hide it.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply