Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Absolute
- AGI
- ai
- AI agents
- AI engineer
- AI researcher
- ajax
- algorithm
- Algorithms
- aliases
- Array 객체
- ASI
- bayes' theorem
- Bit
- Blur
- BOM
- bootstrap
- canva
- challenges
- ChatGPT
Archives
- Today
- In Total
A Joyful AI Research Journey🌳😊
JavaScript: onchange, onkeyup, blur 본문
💻Bootcamp Self-Study Revision✨/JavaScript, jQuery, Ajax
JavaScript: onchange, onkeyup, blur
yjyuwisely 2023. 5. 4. 14:03onchange event is triggered when the input field loses focus and its value has been changed.
예시)
<div class="Sans form-floating text-muted mb-3 is-invalid">
<input class="form-control" name="password" id="password"
placeholder="비밀번호" type="password" required
pattern="^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$"
onchange="validatePassword()" />
<label for="password">비밀번호 (영문 숫자 특수문자 조합, 8자리 이상)</label>
<div class="valid-feedback">좋아요!</div>
<div class="invalid-feedback">영문자, 숫자, 특수기호 조합으로 8자 이상으로
입력하세요.</div>
</div>
//비밀번호 체크
console.log("Password check connect");
function validatePassword() {
const passwordInput = document.getElementById("password");
if (!passwordInput.checkValidity()) {
passwordInput.classList.add("is-invalid");
passwordInput.classList.remove("is-valid");
} else {
passwordInput.classList.add("is-valid");
passwordInput.classList.remove("is-invalid");
}
}
onkeyup event is triggered when a key is released after being pressed down while the input field has focus.
blur event is triggered when the input field loses focus.
참고: https://coding-restaurant.tistory.com/233
728x90
반응형
'💻Bootcamp Self-Study Revision✨ > JavaScript, jQuery, Ajax' 카테고리의 다른 글
모던 자바스크립트) Ajax (0) | 2023.06.14 |
---|---|
HTML5 + CSS3 + JavaScript로 배우는 웹프로그래밍 기초) Ajax (0) | 2023.06.14 |
JavaScript: onbeforeprint 사용해서 [다운로드] 버튼 작동하게 만들기 (0) | 2023.04.24 |
JavaScript: fade 효과 AOS 애니메이션 쓰기 (0) | 2023.04.22 |
Comments