Solved

HTML text area uneditable

Posted on 2007-12-04
5
930 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

751 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