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

반응형

+ Recent posts