Code Snippet

Home » Code Snippets » JavaScript » Auto Select Textarea Text

Auto Select Textarea Text

<textarea rows="10" cols="50" onclick="this.focus();this.select()" readonly="readonly">
   example text
</textarea>

Subscribe to The Thread

  1. So much easier then with jQuery. Just goes to show, a quick search can save you a lot of time, and KB on the finished site. Thanks Chris!

  2. thx a lot!!! its really helpfull, another trick is sucks!!!

  3. Dhaval

    nice one
    for designer its a very easy with help

  4. سازمان غیر دولتی موسسه پروفسور حسابی دارای مجوز رسمی از سازمان ملی جوانان بوده و در محدوده فعالیت ملی و با محوریت علمی و پژوهشی مشغول به کار می باشد.

  5. surf http://www.rapidmaza.com for sending free sms 400 character and for free sms api

  6. thanks… its work! ^^

  7. Great and Works! Thank you.

  8. Just what I was looking for… thanks!

    Do you also have the code to make it automatically copy to the clipboard? That would make my life complete lol.

    cheers

    Stef

  9. This doesn’t work in iOS devices. I’ve seen mention of setSelectionRange() working there, but I can’t get that to work in iOS: http://jsfiddle.net/zBa5n/2/

    Does anyone know how to do this?

  10. Works for me. Thanks!

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~