How can I keep the focus on an input field if the input is incorrect
<p>Given the following code:</p>

<pre><code>sPosSelect="#fpJpos input[name=posnum" + iiPos + "]";
if (fIn&gt;fPosMaxWtUse[iiPos]) {
    alert(sprintf('%.0f is %.0f more than the position max of %.0f.',fIn,fIn-fPosMaxWtUse[iiPos],fPosMaxWtUse[iiPos]));
$(sPosSelect).val('');
$(sPosSelect).focus();
return;
}
</code></pre>

<p>It works in that I get the alert, and the field is blanked. However, the focus then moves on to the next field when what I want is for it to stay on the field just blanked so the user can try again.</p>

<p>All suggestions are welcome, including anything I'm doing that could be done in a better way.</p>

<p>Terry </p>
