728x90
반응형
input type number는 maxlength가 안먹는데, 글자 제한이 필요한 경우 아래 방법을 쓰면된다.
oninput="javascript: if (this.value.length >this.maxLength) this.value = this.value.slice(0, this.maxLength);"
예제
<input type="number" maxlength="10" oninput="javascript: if (this.value.length >this.maxLength) this.value = this.value.slice(0, this.maxLength);">
https://stackoverflow.com/questions/18510845/maxlength-ignored-for-input-type-number-in-chrome
반응형
'Dev > Frontend' 카테고리의 다른 글
[React] 리액트 기본세팅, 실행, 빌드 (0) | 2020.01.22 |
---|---|
공통 css class에 클릭 이벤트 (0) | 2019.11.26 |
자바스크립트 인증번호 타이머 (0) | 2019.11.26 |
자바스크립트 체크박스 전체 선택 (0) | 2019.11.22 |
Angularjs directive 엔터키로 함수실행 (0) | 2019.07.20 |