JSFiddle - React, Tailwind, and code Playground
by this_mong
HTML
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<input type="tel" onkeydown="return onlyNum(event)" maxlength="12" style="ime-mode:disabled;">
JavaScript
function onlyNum(event) {
event = event || window.event;
var key = (event.which) ? event.which : event.keyCode;
if( ( key >=48 && key <= 57 ) || ( key >=96 && key <= 105 ) || key==8)
{
return true;
}else{
alert("숫자만 입력해주세요.");
return false;
}
}