wutske 0 Report post Posted June 4, 2010 I'm having a slight problem with Google Chrome. I have a fairly straight forward form with only a single text field. When this field gains focus, all text should be selected which should work with the following code: <form method='get' action='/cms/search.php' style='margin-right: 10px; margin-bottom: -10px' name='searchform'> <input class='tbox search' type='text' name='q' size='20' value='Zoeken' onFocus='this.select()' /> <input type='hidden' name='r' value='0' /><input class='button search' type='hidden' name='s' value='Zoeken' /> <input type='hidden' name='t' value='all' /> <input type='hidden' name='adv' value='0' /> </form> In Google Chrome however, the field gets selected and then deselected immediatly and it's almost impossible to select the text in that field. I've searched the web, but didn't find any solution . Is there anybody else who had this problem and knows how to fix it ? Share this post Link to post Share on other sites
wutske 0 Report post Posted June 4, 2010 Safari on windows has the same problem Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 9, 2011 SolutionGoogle Chrome Onfocus='this.select()' ProblemWe can avoid whatever is happening in webkit browsers as soon as the focus event handler is finished by forking our text selection using setTimeout: $("input[name=myInput]").Focus(function () { setTimeout('$("input[name=myInput]").Select()', 10); }); Good luck. - Corey Share this post Link to post Share on other sites