File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 11const input = document . querySelector ( "input" ) ;
2- const eye = document . querySelector ( "#eye-icon" ) ;
2+ const eyeOpen = document . querySelector ( ".eye-open" ) ;
3+ const eyeClose = document . querySelector ( ".eye-close" ) ;
34
4- eye . addEventListener ( "click" , ( ) => {
5- input . type === "password" ? ( input . type = "text" ) : ( input . type = "password" ) ;
5+ eyeOpen . addEventListener ( "click" , ( ) => {
6+ input . type = "text" ;
7+ eyeOpen . style . display = "none" ;
8+ eyeClose . style . display = "block" ;
9+ } ) ;
10+
11+ eyeClose . addEventListener ( "click" , ( ) => {
12+ input . type = "password" ;
13+ eyeOpen . style . display = "block" ;
14+ eyeClose . style . display = "none" ;
615} ) ;
Original file line number Diff line number Diff line change 1818 < input type ="password " placeholder ="Password " />
1919 < div class ="eye-container ">
2020 < svg width ="30 " height ="30 " class ="eye-open " id ="eye-icon " fill ="currentColor " viewBox ="0 0 24 24 " xmlns ="http://www.w3.org/2000/svg ">
21- < path fill-rule ="evenodd " d ="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5ZM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5Zm-3-5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3Z " clip-rule ="evenodd "> </ path >
21+ < path d ="M15 11.64a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z "> </ path >
22+ < path d ="M2.4 11.64S6 5.04 12 5.04s9.6 6.6 9.6 6.6-3.6 6.6-9.6 6.6-9.6-6.6-9.6-6.6Zm9.6 4.2a4.2 4.2 0 1 0 0-8.4 4.2 4.2 0 0 0 0 8.4Z "> </ path >
23+ </ svg >
24+ < svg width ="30 " height ="30 " class ="eye-close " id ="eye-icon " fill ="currentColor " viewBox ="0 0 24 24 " xmlns ="http://www.w3.org/2000/svg ">
25+ < path d ="m15.348 17.47-1.936-1.938a4.2 4.2 0 0 1-5.37-5.369l-2.47-2.472C3.526 9.51 2.4 11.576 2.4 11.576s3.6 6.6 9.6 6.6a8.436 8.436 0 0 0 3.347-.706ZM8.652 5.681A8.434 8.434 0 0 1 12 4.976c6 0 9.6 6.6 9.6 6.6s-1.127 2.065-3.169 3.885l-2.474-2.474a4.199 4.199 0 0 0-5.37-5.369L8.653 5.681Z "> </ path >
26+ < path d ="M9.03 11.15a3 3 0 0 0 3.396 3.395L9.03 11.15Zm5.94.85-3.394-3.396a3 3 0 0 1 3.395 3.395Zm3.806 7.2L4.376 4.8l.85-.85 14.4 14.4-.85.85Z "> </ path >
2227 </ svg >
2328 </ div >
2429 </ div >
Original file line number Diff line number Diff line change @@ -57,3 +57,7 @@ input {
5757 color : rgb (10 , 10 , 165 );
5858 cursor : pointer;
5959}
60+
61+ .eye-close {
62+ display : none;
63+ }
You can’t perform that action at this time.
0 commit comments