File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed
Random Password Generator Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change 13
13
< div class ="container ">
14
14
< div class ="inputBox ">
15
15
< h2 > Random Password Generator</ h2 > < input type ="text " placeholder ="Create password " id ="password ">
16
- < div id ="btn " onclick =" generatePassword(); " > Generate Password</ div >
16
+ < div id ="btn "> Generate Password</ div >
17
17
</ div >
18
18
<!--inputBox-->
19
19
</ div >
Original file line number Diff line number Diff line change 1
1
//generate random password using for loop
2
- function generatePassword ( ) {
2
+ document . getElementById ( "btn" ) . addEventListener ( "click" , function ( ) {
3
3
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+?<>{}[]:" ;
4
4
var passwordLength = 10 ;
5
5
var password = "" ;
@@ -8,7 +8,7 @@ function generatePassword() {
8
8
password += chars . charAt ( randomChar ) ;
9
9
}
10
10
document . getElementById ( "password" ) . value = password ;
11
- }
11
+ } ) ;
12
12
13
13
//copy to clipboard
14
14
clipboard . onclick = function ( ) {
Original file line number Diff line number Diff line change 17
17
18
18
.inputBox {
19
19
position : relative;
20
-
21
20
background : # fdd5d5 ;
22
21
width : 450px ;
23
22
padding : 20px 30px ;
34
33
position : relative;
35
34
width : 100% ;
36
35
height : 45px ;
37
- border : none;
38
36
margin : 15px 0 20px ;
39
-
40
37
background : # fff ;
41
-
42
38
border : 2px solid lightgrey;
43
39
padding-left : 15px ;
44
40
border-radius : 5px ;
You can’t perform that action at this time.
0 commit comments