title: How do I make only numbers that can be typed into input?
body: <pre><code>&lt;script&gt;
  function lettersOnly(input) {
  var regex = /[^a-z]/gi;
  input.value = input.value.replace(regex, "");
  }
  &lt;/script&gt;
  
  &lt;input type="tel" name="Contact number" pattern="\d{8}" title='8 digits telephone number' placeholder=" Contact Number" id="contactno"
              onkeyup="lettersOnly(this)"&gt;&lt;br&gt;   
  </code></pre>
  
  <p>The input section is part of a form and I want to make sure only numbers can be typed into the contact number input.</p>