-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PW visibility : hidden 기능 추가 / input 필드 채워질 경우 버튼 색 변경 추가
- Loading branch information
1 parent
6c75923
commit 52f55b3
Showing
4 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
document.addEventListener("click", function(event) { | ||
if (event.target.closest(".toggle-password")) { | ||
const toggle = event.target.closest(".toggle-password"); | ||
const passwordField = toggle.previousElementSibling; | ||
const icon = toggle.querySelector("i"); | ||
|
||
const isPassword = passwordField.type === "password"; | ||
passwordField.type = isPassword ? "text" : "password"; | ||
|
||
icon.classList.toggle("fa-eye"); | ||
icon.classList.toggle("fa-eye-slash"); | ||
} | ||
}); | ||
|
||
|
||
document.querySelectorAll("form").forEach(function(form) { | ||
form.addEventListener("input", function() { | ||
const inputs = form.querySelectorAll("input"); | ||
const submitButton = form.querySelector("button"); | ||
|
||
const allFilled = Array.from(inputs).every(input => input.value.trim() !== ""); | ||
|
||
if (allFilled) { | ||
submitButton.classList.add("button-on"); | ||
submitButton.classList.remove("button-off"); | ||
} else { | ||
submitButton.classList.add("button-off"); | ||
submitButton.classList.remove("button-on"); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css" | ||
/> | ||
<link rel="stylesheet" href="styles/login-signup.css" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> | ||
</head> | ||
<body> | ||
<div class="login-background"> | ||
|
@@ -31,13 +32,20 @@ | |
placeholder="이메일을 입력해주세요" | ||
/> | ||
<label>비밀번호</label> | ||
<div class="password-container"> | ||
<input | ||
class="password-input" | ||
autocomplete="off" | ||
name="password" | ||
type="password" | ||
placeholder="비밀번호를 입력해주세요" | ||
/> | ||
<span class="toggle-password"> | ||
<i class="fas fa-eye-slash"></i> | ||
</span> | ||
</div> | ||
<button class="button-off">로그인</button> | ||
</div> | ||
<button>로그인</button> | ||
<div class="social-login-box"> | ||
<p class="social-login-p">간편 로그인하기</p> | ||
<div class="social-login-link"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css" | ||
/> | ||
<link rel="stylesheet" href="styles/login-signup.css" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> | ||
</head> | ||
<body> | ||
<div class="login-background"> | ||
|
@@ -37,19 +38,33 @@ | |
placeholder="닉네임을 입력해주세요" | ||
/> | ||
<label>비밀번호</label> | ||
<div class="password-container"> | ||
<input | ||
class="password-input" | ||
autocomplete="off" | ||
name="password" | ||
type="password" | ||
placeholder="비밀번호를 입력해주세요" | ||
/> | ||
<span id="togglePassword" class="toggle-password"> | ||
<i class="fas fa-eye-slash"></i> | ||
</span> | ||
</div> | ||
<label>비밀번호 확인</label> | ||
<div class="password-container"> | ||
<input | ||
class="password-input" | ||
autocomplete="off" | ||
name="password-repeat" | ||
type="password" | ||
placeholder="비밀번호를 다시 한 번 입력해주세요" | ||
/> | ||
<span class="toggle-password"> | ||
<i class="fas fa-eye-slash"></i> | ||
</span> | ||
</div> | ||
<button class="button-off">회원가입</button> | ||
</div> | ||
<button>회원가입</button> | ||
<div class="social-login-box"> | ||
<p class="social-login-p">간편 로그인하기</p> | ||
<div class="social-login-link"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters