onlynum
2022. 1. 10. 15:26ㆍjavascript
html
<input type="text" class="wid-col-40" id="mobile" name="mobile" pattern="[0-9]+" />
js
// numberOnly
$(document).on("keyup", "input:text[numberOnly]", function () { $(this).val($(this).val().replace(/[^0-9]/gi, "")); });
'javascript' 카테고리의 다른 글
jq 반복문 return 관련 (0) | 2022.02.08 |
---|---|
js 자주쓰는 정규식 (0) | 2022.01.13 |
jq ajax (0) | 2022.01.09 |
mouseenter, mouseleave / on (0) | 2022.01.01 |
최대값, 최소값 (0) | 2021.12.30 |