Cách chỉ nhập số không cho nhập chữ với input trong jquery.
Ngoài ra nếu chạy trên android hay ios chỉ xuất hiện bàn phím số to rõ dễ nhìn, giúp giao diện app web đẹp hơn
<input class="input-number" type="text" maxlength="5" inputmode="numeric">
<input id="Button1" type="button" onclick="test();" value="button" />
<script>
$('.input-number').on('input', function (event) {
this.value = this.value.replace(/[^0-9]/g, '');
});
</script>
Cách chỉ nhập số không cho nhập chữ với input trong jquery