JSFiddle - React, Tailwind, and code Playground
HTML
<input id='arRange'>
<input id='ccmRange'>
JavaScript
document.getElementById('arRange').onkeypress = function(e) {
var c = (window.event ? e.keyCode : e.which);
if (isNaN(String.fromCharCode(c)) && c != 8 || c == 32 ) { return false; }
}
document.getElementById('ccmRange').onkeypress = function(e) {
var c = (window.event ? e.keyCode : e.which);
if (isNaN(String.fromCharCode(c)) && c != 8 || c == 32 ) { return false; }
}