Using keydown for all Web browsers
<p>Can someone help me, how can i define the <code>keyCode</code>,which,<code>charcode</code> into variable. below is my code. but seems not working in Firefox. i already try at Google chrome and i.e. and its work fine.</p>

<pre><code>    $(function() {
      $('#txtInput').keydown(function(event) {

      var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
            //number
        if (Key &gt;= 48 &amp;&amp; Key &lt;= 57)
            return true;
        //numpad
        else if (Key &gt;= 96 &amp;&amp; Key &lt;= 105)
            return true;
        //backspace,tab
        else if (Key &gt;= 8 &amp;&amp; Key &lt;= 9)
            return true;
        else return false;
    });
});
</code></pre>
