When is JQuery keydown event thrown?
<p>I am using a third-party control (Aspose.Cells.GridWeb). It is basically a web based Excel control.  When a user selects a cell, the onCellSelected event is raised by the control.</p>

<p>The thing is, I need to know what key was pressed by the user to cause this event to be raised. I need this information to determine how to handle the event.</p>

<p>I am using JQuery's keydown event to capture the button clicked.</p>

<pre><code>    $(document).keydown(function(event) {
        isKeyLastClicked = true;
        keyLastClickedId = event.which;
        isMouseButtonLastClicked = false;
        mouseButtonLastClickedId = null;
    });
</code></pre>

<p>The problem is that the control's onCellSelected event is raised BEFORE the keydown event is raised. Is this expected behavior? </p>

<p>Is there any way to get the id of the key before the control's event is raised?</p>

<p>Thanks in advance.</p>
