I want to mark the full content of text fields automatically as soon as the text field gains the focus. I use setSelectionStart und setSelectionEnd in the focus gained.

The problem is that I need to create a focus gained event for all text fields. I wonder if there is a more elegant solution to this?

asked 23.04.2010 at 11:03

Richard%20Schmid's gravatar image

Richard Schmid
(suspended)
accept rate: 25%


Please use the selectAllOnFocusGained property of the text field. It does exactly what you want.

link

answered 25.04.2010 at 05:50

Renato%20Stalder's gravatar image

Renato Stalder
(suspended)
accept rate: 100%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40
×12

Asked: 23.04.2010 at 11:03

Seen: 2,102 times

Last updated: 23.04.2010 at 11:03