javascript keydown and getElementById value issue
<p>This is a part of my code:</p>

<pre><code>button.addEventListener("keydown", function(e) {
    var theVal = document.getElementById('theInput').value;
</code></pre>

<p>The problem is that the thing i'm copying into "theVal" is the thing i'm putting my key
down to. so here button is the same as theInput. so when a user enters:
<strong>hey</strong></p>

<p>theVal actually holds:
<strong>he</strong></p>

<p>so always the last key that was pressed isn't captured. How do i overcome this?</p>
