Let’s say you have a <textarea> like this:

<textarea id="fancy" disabled="disabled"></textarea>  

And you wish to select the text inside. Use the following call in javascript. Easy.


This works in Chrome, but not Firefox. What’s the issue here?!

As it turns out, Firefox won’t let you select within a disabled field, so the solution is to use the readonly attribute.

<textarea id="fancy" readonly="readonly"></textarea>  

The syntax is not exactly the same but it gets the job done.