i have a textarea where terms of agreement is placed. I want the text inside it to be disable if a user tries to change it. Can you help me?Tnx
Announcement
Collapse
No announcement yet.
disable the text in the textarea
Collapse
X
-
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.Zvona
First Aid for
Web Design
-
Actually, last I heard there was a known bug in which onfocus="this.blur()" does NOT work for Gecko browsers (NS6 included). It may have been fixed for Mozilla 1.0 though, and is worth further testing if I get around to it.
Use a combination of:
<textarea readonly="readonly" onfocus="this.blur()">
For best results.
Comment
-
but you can still right-click inside the textarea and it will not trigger onfocus event, so the user can do right-click & paste.
so you must use this combination:
<textarea readonly="readonly" onfocus="this.blur()" onchange="this.value='blah blah'">blah blah</textarea>
to ensure best results
Originally posted by jkd
Actually, last I heard there was a known bug in which onfocus="this.blur()" does NOT work for Gecko browsers (NS6 included). It may have been fixed for Mozilla 1.0 though, and is worth further testing if I get around to it.
Use a combination of:
<textarea readonly="readonly" onfocus="this.blur()">
For best results.
Comment
-
Comment