title: Only allow numbers in an input with javascript and allow copy and paste?
body: <p>I'm using this function to only allow numbers in a text input.</p>
  
  <pre><code>$('input').bind('keydown', function(e) {
  
      var key = e.charCode || e.keyCode || 0;
  
      return (
           key == 8 ||
           key == 9 ||
           key == 46 ||
           (key &gt;= 37 &amp;&amp; key &lt;= 40) ||
           (key &gt;= 48 &amp;&amp; key &lt;= 57) ||
           (key &gt;= 96 &amp;&amp; key &lt;= 105));
  });
  </code></pre>
  
  <p>How would I also allow copy and paste? I've tried adding keycode 17 for control but it still doesn't work.</p>
  
  <p>Is there something special you have to do for key combinations?</p>
  
  <p>Thanks</p>