<!DOCTYPE html>
<html lang="ko">
<head>
<title>Document</title>
<script src="./07-signup.js"></script>
</head>
<body>
<input type="text" id="email" oninput="checkValidation()">
<input type="text" id="pw1" oninput="checkValidation()">
<input type="text" id="pw2" oninput="checkValidation()">
<button id="submit" disabled="true">회원가입</button>
</body>
</html>
const checkValidation = function () {
let email = document.getElementById("email").value
let pw1 = document.getElementById("pw1").value
let pw2 = document.getElementById("pw2").value
if(email && pw1 && pw2 ) {
//모든 input이 비어있지 않을때
document.getElementById("submit").disabled = false
} else {
//하나의 input이라도 비어있을때
document.getElementById("submit").disabled = true
}
}
<!DOCTYPE html>
<html lang="ko">
<head>
<title>Document</title>
<script src="./08-phone.js"></script>
</head>
<body>
<input type="text" id="p1" oninput="changeFocus1()" maxlength="3">-
<input type="text" id="p2" oninput="changeFocus2()" maxlength="4">-
<input type="text" id="p3" maxlength="4">
</body>
</html>
const changeFocus1 = () => {
let phone1 = document.getElementById("p1").value
if(phone1.length === 3) {
document.getElementById("p2").focus()
}
}
const changeFocus2 = () => {
let phone2 = document.getElementById("p2").value
if(phone2.length === 4) {
document.getElementById("p3").focus()
}
}
3분 이내 버튼을 누르지 않는 경우, 인증확인버튼 회색으로 되돌리고, 비활성화
토큰정보를 000000, 시간을 3:00으로 되돌려 주기
부분만 빼고 다 끝낼 수 있었다~~출처 : 코드캠프