title: get input value on keydown and set it to other input
body: <p>I have a input element and want to make sure that only numeric values are allowed. I found a working example <a href="https://stackoverflow.com/questions/995183/how-to-allow-only-numeric-0-9-in-html-inputbox-using-jquery" title="here">here</a>.</p>
  
  <p>Now I want to get the value of this field and write it into an other input element:</p>
  
  <pre><code>$(".firstinput").keydown(function (e) {
      // Allow: backspace, delete, tab, escape, enter and .
      if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
           // Allow: Ctrl+A, Command+A
          (e.keyCode == 65 &amp;&amp; ( e.ctrlKey === true || e.metaKey === true ) ) || 
           // Allow: home, end, left, right, down, up
          (e.keyCode &gt;= 35 &amp;&amp; e.keyCode &lt;= 40)) {
               var $this = $(this).val();
               $("copiedinput").val($this);
               return;
      }
      // Ensure that it is a number and stop the keypress
      if ((e.shiftKey || (e.keyCode &lt; 48 || e.keyCode &gt; 57)) &amp;&amp; (e.keyCode &lt; 96 || e.keyCode &gt; 105)) {
          e.preventDefault();
      }
  });
  </code></pre>
  
  <p>This almost works but I do only get the value after pressing enter or backspace. Typing in '222' and backspace leads to '22' for the .firstinput and '222' for the .copiedinput. How can I get the live value?</p>