Tuesday, April 17, 2007

Adding Click to Select All Text: Javascript

If you want your users to click on a text area and automatically highlight all of the text, there is a very simple way to do it. This does not require external javascript at all. It’s no "copy code" button, but if the user clicks inside the text area, this bitt of code will hightlight all of the text in that textfield.

Add the following code to any <> tag:

onclick="javascript:select();"

Example:


No comments: