HTML <input> 자동 초점 속성
예시
페이지가 로드될 때 "이름" 입력 필드가 자동으로 포커스를 받도록 합니다.
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname" autofocus><br><br>
<label for="lname">Last
name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit">
</form>
정의 및 사용
autofocus
속성은 부울 속성입니다 .
존재하는 <input>
경우 페이지가 로드될 때 요소가 자동으로 포커스를 받아야 함을 지정합니다.
브라우저 지원
표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Attribute | |||||
---|---|---|---|---|---|
autofocus | 5.0 | 11.0 | 4.0 | 5.0 | 9.6 |
통사론
<input autofocus>
HTML <입력> 태그