Javascript: example of setting the readOnly attribute of for input


1. Js is < Input> Set the readOnly property

          < Textarea name=“content” id=“content” cols=“27” rows=“6”> < / textarea>

          Var cObj = document. GetElementById (” content ”);

          CObj. SetAttribute (” readOnly ”, “true”);

2. Js removal < Input> ReadOnly attribute

        Var cObj = document. GetElementById (” content ”);         CObj. RemoveAttribute (” readOnly ”);

Note: be sure to pay attention to the readOnly case!!