study
숫자만 입력 인풋박스 input text number only
intseq
2019. 7. 13. 19:06
function inNumber(){
if(event.keyCode<48 || event.keyCode>57){
event.returnValue=false;
}
}
출처: https://gocoder.tistory.com/111 [고코더 IT Express]
<input type="text" onKeyup="this.value=this.value.replace(/[^0-9]/g,'');"/>
출처: https://gocoder.tistory.com/111 [고코더 IT Express]
<html>
<head>
<script type="text/javascript">
function inNumber(){
if(event.keyCode<48 || event.keyCode>57){
event.returnValue=false;
}
}
</script>
</head>
<body>
<input type="text" onkeypress="inNumber();"/>
<input type="text" onKeyup="this.value=this.value.replace(/[^0-9]/g,'');"/>
</body>
</html>
출처: https://gocoder.tistory.com/111 [고코더 IT Express]