Javascript: example of setting the readOnly attribute of for input
- 2020-03-30 01:04:57
- OfStack
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!!