input olny number - RLidea/dev.docs GitHub Wiki
<form action="">
<input type="text" id="onlyNumber" onkeypress="acceptOnlyNumber(event)" />
</form>
<script>
function acceptOnlyNumber(event) {
console.log(event.target);
if (event.which && ((event.which > 47 && event.which < 58) || event.which == 8)) {
console.log('number');
} else {
console.log('not number');
event.preventDefault();
}
}
</script>