Neor,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.addEventListener("DOMContentLoaded", function() {
var form = document.querySelector("form");
function getChar(event) {
if (event.which == null) {
if (event.keyCode < 32) return null;
return String.fromCharCode(event.keyCode)
}
if (event.which != 0 && event.charCode != 0) {
if (event.which < 32) return null;
return String.fromCharCode(event.which)
}
return null
}
form.addEventListener("keypress", function(event) {
var el = event.target;
if (el.classList && el.classList.contains("item")) {
var chr = getChar(event);
chr !== null && chr >= '0' && chr <= '9' || event.preventDefault()
}
})
});
</script>
</head>
<body>
<form action="http://">
<input type="text" class="item">
<input type="text" class="item">
<input type="text" class="item">
</form>
</body>
</html>