Stop editing in text area

Discussion in 'JavaScript' started by blueparukia, Sep 20, 2007.

  1. #1
    I have a textarea with text in it, but I don't want you to be able to edit the text. I have tried <textarea disable> but that stops you from scolling, and highlighting text. So could you do this with JavaScript?

    Thanks,

    BP
     
    blueparukia, Sep 20, 2007 IP
  2. YIAM

    YIAM Notable Member

    Messages:
    2,480
    Likes Received:
    240
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Try
    <textarea readonly="true">
     
    YIAM, Sep 20, 2007 IP
  3. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #3
    Thanks, I knew that already, I just wonder why I didn't think of it....


    Thanks again,

    BP
     
    blueparukia, Sep 20, 2007 IP
  4. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #4
    READONLY Attribute | readOnly Property

    Sets or retrieves the value indicated whether the content of the object is read-only.

    Syntax
    HTML < ELEMENT READONLY ... >
    Scripting object.readOnly [ = bRead ]

    bRead: Boolean that specifies or receives one of the following values.
    + false Default. Property is not set on the object.
    + true Object is set to read-only.

    The property is read/write. The property has a default value of false .

    Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties .

    Remarks

    If the value of the readOnly property is set to true , the user cannot enter or edit text in the control. When set to true , the property still allows the object to receive the focus, whereas the disabled property does not.

    Standards Information
     
    temp2, Oct 1, 2007 IP