입력 요소에는 자동 완성 속성이 있어야 합니다.
콘솔에서 이 메시지를 받고 있는데 이해할 수가 없습니다.한 번 알아봐 주세요.
<!DOCTYPE html>
<html>
<head>
<title>registration page</title>
<script src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('form').submit(function(event){
"use strict";
var valid = true,
message = '';
$('.error').remove();
$('form input').each(function() {
var $this = $(this);
if(!$this.val()) {
message='';
var inputName = $this.attr('name');
valid = false;
message += 'Please enter your ' + inputName + '\n';
$(this).closest('div').append('<div class="error">'+message+'</div>');
}
})
if(!valid){
event.preventDefault();
}else{
$('form').serialize()
}
})
})
</script>
</head>
<body>
<form>
<div>
<label>Name</label>
<input type="text" name="name"><br>
</div>
<div>
<label>File</label>
<input type="file" name="file"><br>
</div>
<div>
<label>password</label>
<input type="password" name="password"><br>
</div>
<button type='submit'>Submit</button>
</form>
</body>
</html>
문제는 오류가 없음에도 불구하고 이 메시지가 계속 수신된다는 것입니다.
[DOM] Input elements should have autocomplete attributes (suggested: "current-password"):
콘솔로 이동할 수 있는 Google 링크를 제공받았습니다(자세한 정보: goo.gl/9p2vKq)
변경 시도
<input type="password" name="password">
로.
<input type="password" name="password" autocomplete="on">
자동 완성을 통해 웹 개발자는 사용자 에이전트가 양식 필드 값을 작성하는 데 필요한 권한을 지정할 수 있을 뿐만 아니라 필드에 예상되는 정보 유형에 대한 브라우저 안내를 제공할 수 있습니다.
아주 강력합니다.
자동 완료 해제
아래 형식의 오류로 작업할 수 있는 아래 옵션이 있습니다. 입력 요소는 콘솔에서 다음을 수정하여 자동 완성 속성을 부여해야 합니다.
<input type="password" name="password">
- 셋 더
autocomplete
에 귀속시키다off
에서<form>
아니면<input>
다음 항목:- 브라우저를 통해 데이터를 저장하지 않음
- 세션 기록에서 양식 데이터 캐싱을 비활성화합니다.
<input type="password" name="password" autocomplete="off">
- 브라우저에 의한 자동 채우기를 방지하는 또 다른 방법은 다음과 같습니다.
아래 제안 사항은 브라우저별로 다릅니다.
<input type="password" name="password" autocomplete="new-password"> <!-- For Mozilla-->
<!-- or -->
<input type="password" name="password" autocomplete="current-password"> <!-- For Chrome-->
자동 완성 속성은 암호 관리자가 잘못된 데이터를 저장하거나 자동으로 채우는 것을 방지함으로써 필드의 목적을 양식으로 추론하는 데 도움이 됩니다.
사용할 수 있습니다.autocomplete
값을 자동으로 채우기 위해 암호 관리자가 관리해야 하는 HTML 요소의 속성입니다.의 가치.autocomplete
속성은 암호 관리자에게 더 많은 정보를 전달할 필드에 따라 달라집니다.다음과 같은 예를 생각해 봅니다.
- 현재 비밀번호 필드 -
autocomplete="current-password"
- 새 비밀번호 필드 -
autocomplete="new-password"
- 신용카드 필드 -
autocomplete="cc-number"
크롬으로 되어있습니다.이는 브라우저 및 확장 프로그램의 암호 관리 기능이 사용자 사이트의 서명, 로그인 및 암호 변경 양식을 이해할 수 있도록 하기 위한 것으로, 약간의 메타데이터를 통해 HTML을 강화할 수 있습니다.
이것은 https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands 에 도움이 될 것입니다.
TypeScript 3.9로 인해 autoComplete --capital "C"를 사용하게 되었습니다.
Bootstrap과의 반응으로 capital "C"와 함께 autoComplete를 사용해야 했습니다.
질문에 대한 답이 나온 것으로 알고 있습니다. 이는 "react.js"를 사용하는 동안 콘솔에서 이 경고 메시지를 제거하려는 사람들을 위한 것입니다.
입력란에 추가하기만 하면 됩니다.
autoComplete="true"
이것이 전부입니다.
<input type="password" className="form-control" placeholder="Password"
autoComplete="true"
name='password'
required={true} />
반응에서 입력 요소는 autoComplete prop를 가질 수 있습니다.이 소품은 사용자가 특히 모바일 장치에서 양식을 더 빠르게 채울 수 있도록 도와줍니다.이름이 오토필에 가깝기 때문에 헷갈릴 수 있습니다.자세한 내용은 https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill 에서 확인할 수 있습니다.
언급URL : https://stackoverflow.com/questions/54970352/input-elements-should-have-autocomplete-attributes
'programing' 카테고리의 다른 글
명령줄 응용 프로그램의 키보드 입력 (0) | 2023.10.19 |
---|---|
PowerShell로 텍스트 파일 맨 위 줄 제거 (0) | 2023.10.19 |
UIRepreshControl을 UIScrol View에서 사용할 수 있습니까? (0) | 2023.10.14 |
Mysql, 긴/큰 데이터에서 넓은 데이터로 재구성 (0) | 2023.10.14 |
JS 파일 내 PHP 상수 (0) | 2023.10.14 |