Click to Hightlight all text: It’s Easier than you think.

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 < textarea > tag:

onclick="javascript:select();"

Example:

<textarea cols="50" rows="3" onclick="javascript:select();"> Highlight this text</textarea>

Related Posts:

  1. How to Vectorize Text with 1 click - Photoshop CS2
  2. Photoshop 101: Edit Text Faster
  3. How to delete all Hidden Layers at the same time in Adobe Photoshop
  4. Illustrator 101: Escape Text Boxes without the Mouse
  5. How to get your Applications Folder in your Dock - Mac OS X
  6. Glossy Vector Web 2.0 Logo Text in 5 Easy Steps

This entry was posted on Sunday, January 7th, 2007 at 3:46 am and is filed under Javascript. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Stumble It
Add to Del.icio.us

Did you like this post?

Digging and sharing is a great way to say thanks!

11 Responses to “Click to Hightlight all text: It’s Easier than you think.”

  1. This is a nice little snippet of Javascript. I’ve put it to great use on my site. Thanks.

  2. Thanks! Found this really useful.

  3. Thanks! I’ve been looking for this script for a while.

  4. [...] Click to Hightlight all text: It’s Easier than you think. | BittBox Click to Hightlight all text: It’s Easier than you think. Posted on January 7th, 2007 by BittBox. If you want your users to click on a text area and [...]

  5. thanks !

  6. thanks !

  7. 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.

    this very good for me thanks for this post

  8. Thanks - that is a really helpful snippet of code. It will be especially helpful when creating code sample boxes.

  9. thanks…

  10. cool .. nice script

  11. Thx.It’s useful!

LEAVE A COMMENT




Message: