- Where Developers Learn, Share, & Build Careers


This code should select the contents of a Texter, when the text is selected, however, it does not work by itself:

  $ ("# form"). Focus (function () {$ ("# form"). Select ();});   

This only works when I give it a setTimeout of 0 like:

  $ ("# Form "). Focus (function () {setTimeout (function () {$ ("#Format"). Select ();}, 0);});   

Why is that so?

It looks like the first code, selecting the snippet, then deselecting the text I suspect that Text selection is being exposed after the event after the focus event is over, and after setTimeout select (when behind Things have already happened).

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -