The difference between disabled and readonly

The disabled attribute of the input tag is used, but after submitting the data, it is found that the user name is displayed as empty. Later, I found out that when the input is set to the disabled value, there will be the following restrictions:
1. It cannot receive the focus;
2. It will be skipped when using the tab key;
3. It may not be successful.

The solution is: you can use the readonly=”readonly” attribute instead, and there are some limitations when the input is set to the readonly attribute:
1. It can receive the focus, but cannot be modified;
2. You can use the tab key to navigate;
3. It may be successful.

Because only successful form elements are valid data, that is, they can be submitted.

PS: The text input boxes of disabled and readonly can only be modified by scripting the value attribute

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326826647&siteId=291194637