How do I set the value of readOnly in JS
- 2020-03-30 01:05:01
In the web page, we sometimes need to control the "input state" of the text input box, and some key properties cannot be modified. At this time, we need to set the readonly property of the text input box to False, which can be used in the web page
< Input name="txt_name" type="text" readonly="readonly" id="txt_Status" name="txt_name" style="width:150px;" / >
But in JS we can not eat txt_name.readonly="readonly" to set this property, because JS is case-sensitive, so, when calling this property, we must use txt_name.readonly= true to set.
Of course, the web text box also has a property that controls its state, disabled. This property also restricts the user from modifying the content of the text box, except that if the property is set to "disabled", the C# code cannot get the content of the control.