for positive numbers only



  • how not to make unnecessary values in the field So nothing happens. You know, you know, there's no entry in the field.

    js

    var input = document.getElementById('place'),
           reg = "/^[\d]+$/g";
        input.value = input.value.replace(reg, '');
    


  • Your code should look like:

    var input = document.getElementById('place'),
    input.value = input.value.replace(/[^\d]/g, '');
    

    So mean, we're removing all the numbers.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2