폼 로드시 특정 태그에 포커스 주기 main코드
1. html autofocus 속성 사용
<form action="">
First name: <input type="text" name="fname" autofocus><br>
Last name: <input type="text" name="lname"><br>
<input type="submit">
</form>
2. jQuery 사용
<form action="">
First name: <input type="text" id="txtTitle"><br>
Last name: <input type="text" ><br>
<input type="submit">
</form>
...
$(function () {
$('#txtTitle').focus(); // 폼로드시 id가 txtTitle에 포커스 주기
});
'웹개발' 카테고리의 다른 글
웹팩 Webpack 이란 (0) | 2018.07.01 |
---|---|
어플리케이션 캐시 Application cache 브라우저 지원여부 (0) | 2017.11.23 |
*.ejs파일 vscode에서 html 주석 단축키 만들기, 현재 날짜시간 입력 (0) | 2017.11.20 |
$(function() 와 $(document).ready(function() 는 같은 의미 (0) | 2017.11.16 |
*.ejs vscode에서 emmet 사용가능하게 하려면 (0) | 2017.11.13 |