Reputation: 303
I have some fields that are currently input fields. Some should allow edits and others not. Without changing them from input fields, is there a simple way to make it so I cannot edit these? I'm looking for just one CSS or other kind of property if that exists.
thanks
Mariko
Upvotes: 2
Views: 5958
Reputation: 3985
either
<textarea ... readonly="readonly"></textarea>
and/or :
<textarea ... disabled="true"></textarea>
I prefer readonly -attribute, which just prevents modifying. Disabled attribute makes the whole area look disabled (grey) and disabled textarea's data isn't submitted, when a form is posted.
Upvotes: 1
Reputation: 17034
<input type="text" id="id" name="id" value="" readonly="readonly" />
Upvotes: 1
Reputation: 53781
Or disabled
: <input disabled>
You can style both with CSS:
input:disabled
or input[disabled]
for disabled
input[readonly]
for readonly
Upvotes: 4
Reputation: 4351
You can add the readonly="readonly" attribute to the input elements.
Upvotes: 9