How to allow only 4 digit numbers in html textbox?
<p>I have tried to restrict users in HTML text box to insert only 4 digit numbers 0-9.</p>

<p>I have tried as follows but it restrict only to allow two digit numbers. </p>

<pre><code>&lt;input type="text"  name="pincode" maxlength="4"  id="pin" pattern="^0[1-9]|[1-9]\d$" required/&gt;
</code></pre>