title: html pattern to only accept numbers
body: <p>I have this simple html:</p>
  
  <pre><code>&lt;input type="text" 
         placeholder="onlynumbers" 
         name="onlynumbers" 
         pattern="\d{1,5}"  
         maxlength="5"&gt;
  </code></pre>
  
  <p>I need to restrict the number of characters to 5. It works. But I still can type other characters than numbers.
  I have tried various pattern, for example:</p>
  
  <pre><code>pattern = "[0-9]"
  </code></pre>
  
  <p>But it is still possible to type other characters than digits.</p>
  
  <p>If I change the <code>type</code> attribute to <code>number</code>, then only digits are accepted in the input field but the <code>maxlength</code> attribute doesn't work. I can enter as many digits as I want. I heard this was a bug in Chrome. Is that the problem?</p>
  
  <p>Is there a cross-browser way to fulfil these requirements:</p>
  
  <p><em>An input field (text or number, no matters) that only accept digits and doesn't let the user enter more than 5 digits.</em></p>