Calling onkeyup function only once
<p>I've written a sample HTML page</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
function validate() {
alert(document.getElementById('newpass').value);
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;input type="text" id="newpass" onkeyup="validate();" /&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>But in cases like when I press backspace, the function is getting called multiple times.
How do I make it to execute only once ?</p>

<p>All i want to do is to get the current value of a input box on an event, currently onkeypress is not giving the current one, but the previous one. onkeyup gives current but is executing many times.</p>
