- 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
Post a Comment