Contents
see List작성일 2020. 11. 29.
HTML 크롬 자동완성 끄기
Chrome 브라우저에서 input 필드의 자동완성 기능을 비활성화하는 방법입니다.
기본 방법
<!-- 방법 1: autocomplete="off" -->
<input type="text" autocomplete="off">
<!-- 방법 2: autocomplete="no" (일부 브라우저) -->
<input type="text" autocomplete="no">
<!-- 방법 3: 새로운 비밀번호 암시 -->
<input type="password" autocomplete="new-password">
form 전체에 적용
<form autocomplete="off">
<input type="text" name="username">
<input type="password" name="password">
<button type="submit">로그인</button>
</form>
Chrome에서 확실하게 끄기
<!-- Chrome은 autocomplete="off"를 무시할 수 있음 -->
<!-- 방법 1: 랜덤 값 사용 -->
<input type="text" autocomplete="nope">
<input type="password" autocomplete="new-password">
<!-- 방법 2: readonly 후 focus시 해제 -->
<input type="text" readonly onfocus="this.removeAttribute('readonly');">
<!-- 방법 3: 숨겨진 더미 필드 -->
<input type="text" style="display:none">
<input type="password" style="display:none">
<input type="text" name="username">
<input type="password" name="password">
autocomplete 속성 값
| 값 | 설명 |
|---|---|
| off | 자동완성 끄기 |
| on | 자동완성 켜기 |
| new-password | 새 비밀번호 (저장 안함) |
| current-password | 현재 비밀번호 |
| one-time-code | 일회용 코드 (OTP) |
| username | 사용자명 |
| 이메일 | |
| tel | 전화번호 |
| name | 이름 |
JavaScript로 제어
// jQuery
$("input").attr("autocomplete", "off");
// Vanilla JS
document.querySelectorAll("input").forEach(function(el) {
el.setAttribute("autocomplete", "off");
});
// 동적으로 생성된 input에도 적용
$(document).on("focus", "input", function() {
$(this).attr("autocomplete", "off");
});
특정 필드별 자동완성
<!-- 주소 자동완성 -->
<input type="text" autocomplete="street-address">
<input type="text" autocomplete="postal-code">
<input type="text" autocomplete="country">
<!-- 신용카드 자동완성 -->
<input type="text" autocomplete="cc-number">
<input type="text" autocomplete="cc-exp">
<input type="text" autocomplete="cc-csc">
CSS로 자동완성 스타일 제거
/* Chrome 자동완성 배경색 제거 */
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
box-shadow: 0 0 0 1000px white inset;
}
input:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0 1000px white inset;
}html
| No | 작성일 | Title |
|---|---|---|
| 3364 | 2026. 08. 16. | HTML 폼 오류를 누구나 이해하게 만드는 방법: label·aria-describedby·aria-live 실전 가이드 |
| 3332 | 2026. 08. 07. | CSS @layer로 스타일 충돌 줄이기: 대규모 웹 프로젝트 우선순위 설계 가이드 |
| 3300 | 2026. 07. 30. | CSS Container Query 실전 적용: 컴포넌트가 놓인 영역에 맞춰 반응형 만들기 |
| 3269 | 2026. 07. 22. | 접근성 있는 모달 만들기: HTML dialog와 포커스 관리 실전 가이드 |
| 3241 | 2026. 07. 14. | 반응형 이미지 최적화: picture·srcset·sizes로 모바일 전송량 줄이기 |
| 3186 | 2026. 07. 05. | HTML Popover API로 자바스크립트 드롭다운 메뉴 줄이기 |
| 3144 | 2026. 06. 27. | CSS 컨테이너 쿼리 운영 가이드: 화면이 아니라 컴포넌트 폭에 맞춰 레이아웃 바꾸기 |
| 3088 | 2026. 06. 19. | 접근성 있는 모달 창 구현: dialog, focus, 닫기 동작을 함께 설계하기 |
| 2999 | 2026. 06. 11. | HTML 폼 검증 운영 가이드: 브라우저 기본 검증과 서버 검증을 함께 설계하기 |
| 2943 | 2026. 06. 03. | CSS 컨테이너 쿼리 실전 적용: 화면이 아니라 컴포넌트 너비에 맞춰 카드 레이아웃 바꾸기 |