problem with Chrome form handling: input onfocus="this.select()"
- by binaryorganic
I'm using the following HTML code to autoselect some text in a form field when a user clicks on the field:
input onfocus="this.select()" type="text" value="Search"
This works fine in Firefox and Internet Explorer (the purpose being to use the default text to describe the field to the user, but highlight it so that on click they can just start typing), but I'm having trouble getting it to work in Chrome. When I click the form field in Chrome the text is highlighted for just a split second and then the cursor jumps to the end of the default text and the highlighting goes away.
Any ideas on how to get this working in Chrome as well?