Hulk
Hulk

Reputation: 34170

Textarea css not clickable

How to set the css of a textarea not to be clicked on it.

           <textarea></textarea>

Thanks

Upvotes: 3

Views: 7057

Answers (4)

Ognyan Dimitrov
Ognyan Dimitrov

Reputation: 6251

If you care to be By-The-Book & standard compliant it is as follows :

  1. For "Unclickable"

    <textarea readonly> ... </textarea>

  2. For "Grayed & unclickable" aka Disabled :

    <textarea disabled> ... </textarea>

You can find all other properties of "textarea" here.

Upvotes: 0

RoToRa
RoToRa

Reputation: 38420

So you don't want the user to edit the contents of the textarea? Simple solution: Don't use textarea. Just use a normal div or pre and style it.

Upvotes: 2

D&#228;nu
D&#228;nu

Reputation: 5929

You Cant do this with CSS, you have to do it in the markup like so:

<textarea disabled="disabled"></textarea>

Upvotes: 1

ЯegDwight
ЯegDwight

Reputation: 25229

Try

<textarea disabled="yes"></textarea>

In most browsers, this will grey out the content of the textarea though, and the user won't be able to copy any text from within it. If you don't like that, you can use:

<textarea readonly="yes"></textarea>

The textarea will then remain clickable, and the user will still be able to select/copy text within it, but he won't be able to edit it.

Upvotes: 13

Related Questions