<input type="number" max="10" min='1' id='number'> <script> document.getElementById("number").addEventListener("input",function(event){ event.target.value = event.target.value.replace(/-/g,""); }); </script>