더 나은 프로그래머가 되자

숫자만 입력받는 간단한 정규식 스크립트 본문

언어/js

숫자만 입력받는 간단한 정규식 스크립트

greathuman 2022. 5. 3. 13:42
<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"/>

숫자자 이외의 텍스트는 정규식으로 치환처리

Comments