input field, only numbers jquery/js
<p>I have a input field where i only wish users to type numbers </p>

<p>html: <code>&lt;input id="num" type="text" name="page" size="4" value="" /&gt;</code>  </p>

<p>jquery/ js: </p>

<pre><code> $("#num").keypress(function (e){
      if( e.which!=8 &amp;&amp; e.which!=0 &amp;&amp; (e.which&lt;48 || e.which&gt;57)){
     return false;
      }
});
</code></pre>

<p>hope someone can help me. </p>

<p>btw: I'm not interesting in a larger jquery plugin to make the function work. (I have found some jquery-plugins , but there must be som other ways to fix it, with a smaller code)</p>
