◽ HTML & CSS & JS, jQuery

[HTML, CSS, JavaScript] input type="text" 숫자만 입력하게

input type이 num이면 숫자만 입력이 되지만, maxlength가 안먹혀 원하는 기능을 구현 못한다. 그러자니 input text로 하니 maxlength는 먹히는데 숫자 외에도 입력이 된다. 이 점을 가장 간단히 해결하면 아래의 코드와 같다.


 

See the Pen onlyNumber by bfh3000 (@bfh3000) on CodePen.

 

 

 

더 간단한 방법

See the Pen number2 by bfh3000 (@bfh3000) on CodePen.

 

푸터바