Solved

HTML text area uneditable

Posted on 2007-12-04
5
931 Views
Last Modified: 2013-12-13
ok so i need a text area in an html file that contains text that cannot be edited. kinda like what you see when you agree to terms and conditions then check a box that says i agree, then you proceed to login or signups.....
0
Comment
Question by:bcmeyer1983
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 125 total points
ID: 20406957
<textarea readonly name="mytext">text here</textarea>
0
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 125 total points
ID: 20406972
In fact, both the readonly and disabled attributes would work in your case, since it doesn't really matter if the terms text is sent with your form. Therefore, you can also do

<textarea name="mytext" disabled>text here</textarea>
0
 
LVL 2

Author Comment

by:bcmeyer1983
ID: 20406987
what does this to to it:
onFocus="this.blur()
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 20407004
That is Javascript code that will not let the user click into the field. It could be used to imitate readonly behavior (because readonly is subtly different from disabled) in extremely old browsers.

Nowadays, do not use something like that. It is Javascript, and many users have Javascript disabled. It can be done with the attributes steelseth and I have given you, so there is no need for it. (There may be other ways around the Javascript as well, but the attributes are pretty much foolproof).
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 20407044
try this
<script type="text/javascript">

function setRead(bool) {
   if(bool) {
      document.getElementById("ta").readOnly = true;
   }
   else {
      document.getElementById("ta").readOnly = false;
   }
}

</script>

<textarea id="ta"></textarea>
<input type="checkbox" onclick="setRead(this.checked)" />
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question