Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HTML text area uneditable

Posted on 2007-12-04
5
Medium Priority
?
933 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
5 Comments
 
LVL 20

Accepted Solution

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

Assisted Solution

by:Zyloch
Zyloch earned 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

877 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