Why does setTimeout(myFunction, 0) work, but running the function itself not work?
<p>This code should select the contents of a textarea when that textarea is selected. However, it doesn't work by itself:</p>

<pre><code>        $("#form").focus(function() {
            $("#form").select();
        });
</code></pre>

<p>It only works when I give it a <code>setTimeout</code> of 0, like so: </p>

<pre><code>        $("#form").focus(function() {
            setTimeout(function() {
                $("#form").select();
            }, 0);
        });
</code></pre>

<p>Why is that?</p>
