JS Password Generator

  1. How do I make it look better? How do I make the input perfectly center inside #wrapper? display: block and margin: 0 auto; doesn’t work.

  2. Why isn’t the copy function working? Help me understand.

1 Like

margin: 1.5em auto; on your input instead of just margin: 1.5em; to center the input

What does your copy function need to do? Copy a generated password and paste it in your new password input box?

Clicking on generate password doesn’t fill up your input box btw.

Just to copy the generated password to the clipboard.

It does work but you need to enter the number of characters that you want the password to be. “Password Length” requires a number.

im not sure how to fully fix the problem as im not that great at javascript but i have noticed a few things that may be causing a problem 1. you have made the variable newPassword inside a function so using it outside this function will will not work because of it scope and 2. you dont need to put .value on the end of the node to use it in range.selectNodeContents() this will cause an error

Hey! Got an idea that you might like. Set a minimum number of char for the inputs. Example:

Password length (min: 10 chars):
IF chars < 10

  • Tech