Answers for "html input for numbers only"

0

input number only html

<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');" />
 Run code snippet
Posted by: Guest on October-27-2021
0

input text tag only input integer number

<input type="text" class="number" />

<script>
function degitOnly(e){
    var unicode = e.charCode ? e.charCode : e.keyCode;
      if (unicode!=8 && unicode!=9)
     {
     	 if (unicode<46||unicode>57||unicode==47)
     		 return false
    }
}

$(".number").inputFilter(function(value) {
    return /^-?\d*$/.test(value);
});
</script>
Posted by: Guest on April-30-2021

Code answers related to "html input for numbers only"

Browse Popular Code Answers by Language