There are two ways to disable form submission in html, they are:
1. Add readonly='readonly' attribute to the control label
2. Add disabled='disabled' attribute to the control label
For example:
<input type=text value= readonly=readonly /> <input type=text value= disabled=disabled />
Both controls in the example are not modifiable. But they also have some differences!
From the literal meaning we can know that the control that uses the readonly property is read-only, while the disabled is disabled. So what is the difference between them?
Read-only controls (controls that use readonly attribute) cannot be modified by users with the mouse and keyboard, but programmers can use JavaScript to modify them. When submitting the form, the name and value of the control will be submitted to the server, which means it is visible to the server.
The disabled control (control with disabled attribute) is not only not allowed to be modified by the user with the mouse and keyboard, but is also invisible to the server, that is, the name and value will not be submitted to the server when submitting the form. Of course, programmers can also use javascript to modify their value.
This is their difference. After knowing the difference, we should know when to use which method. Don’t be blind!
SummarizeThis is the article about the difference between the disabled attributes of html form controls and readonly VS disabled. This is all about this article. For more related html readonly disabled content, please search for previous articles from Wulin.com or continue to browse the related articles below. I hope everyone will support Wulin.com in the future!