input 비활성화
disabled _ form 내부에서 전송불가능
<input type="password" id="pass2" disabled />
readOnly _ form 내부에서 전송가능
<input type="password" id="pass1" readonly />
아이콘삽입
- 1개
//input css
background: url(images/icon.png) no-repeat 7px 7px;
- 2개
//input css
background: url(image/icon.png), url(image/check.png)
background-repeat: no-repeat;
background-position: left top, right bottom;
최소, 최대 글자수 설정
- 최소글자수
<input type="text" name="usrname" minlength="10">
- 최대글자수
<input type="text" name="usrname" maxlength="10">
박스선택시 테두리 설정
- 테두리 색상 변경
input:focus {outline:2px solid #d50000;}
- 테두리 없애기
input:focus {outline:none;
현재 날짜, 시간 default 설정
- 현재월
<form>
<input type='month' id='currnetMonth'>
</form>
<script>
document.getElementById('currnetMonth').value= new Date().toISOString().slice(0, 7);
</script>
- 현재날
<form>
<input type='date' id='currentDate'/>
</form>
<script>
document.getElementById('currentDate').value = new Date().toISOString().substring(0, 10);;
</script>
- 현재시간
<form>
<input type='time' id='currentTime'/>
</form>
<script>
document.getElementById('currentTime').value = new Date().toISOString().slice(11, 16);
</script>
- 현재날짜 +시간
<form>
<input type="datetime-local" id='currentDatetime'/>
</form>
<script>
document.getElementById('currentDatetime').value= new Date().toISOString().slice(0, -1);
//분까지만 나타내기
document.getElementById('currentDatetime').value= new Date().toISOString().slice(0, 16);
</script>
반응형
'그때 그때 > HTML' 카테고리의 다른 글
시맨틱 마크업 / sementic markup (0) | 2024.03.22 |
---|---|
textarea placeholder 줄바꿈 (0) | 2023.04.27 |
input date 키보드입력 막기 (0) | 2022.08.25 |
html 파일 분리하는법 (0) | 2020.11.26 |
selectbox placeholder 만들기 (0) | 2020.11.25 |