Summary of several non editable methods for setting the text input field of form elements
Code:
<input type="text" value="fisker" onclick="alert(this.value);" onfocus="this.blur()" />
The input box cannot get focus and cannot be edited The form gets the value. It can be copied. It’s weird. You’ve got it, haven’t you got the focus yet?
2, readonly
Code:
< Input type = “text” value = “fisker” onclick = “alert (value) this.;” Readonly / >
Input field read only. Can’t edit Again, the form gets the value. You can copy it.
3, the disabled
Code:
<input type="text" value="fisker" onclick="alert(this.value);" disabled />
Input box gray, cannot edit You can change or get its value with JS, but you don’t commit the value when you commit it.