Sometimes, we want the text box in the form to be read-only so that the user cannot modify the information in it. For example, in the content of , the word "China" cannot be modified. To summarize, the implementation methods are as follows.
Method 1: onfocus=this.blur() Leave focus when the mouse cannot be placed
Method 2: readonly
Method 3: disabled
Full example:
disabled="true " The text will turn gray and cannot be edited.
readOnly="true" The text will not change color and is not editable
css shielding input:
There are two The first method: disabled="disabled" is defined so that the disabled input element is neither available nor clickable. Second: readonly="readonly" read-only fields cannot be modified. However, users can still use the tab key to switch to the field and select or copy its text;