To disable the select drop-down box, use disabled=”disabled”.
In the process of project development, the page would jump to another page after selecting a value in the drop-down box. During the process, the drop-down box was set as Disabled (the value of the drop-down box cannot be changed due to requirements), but the value of the drop-down box was found missing (or empty) when submitting later. After searching for the reason for a long time, The drop-down box is found to be disabled
It is then found that Disabled cannot commit a value. In this case, the solution is:
If the property is set to Disabled, the value of select cannot be passed during submission. Remove the Disabled property before submission
Many people think that setting disabled=”true” is enabled, and setting false is disabled, which is wrong. Whenever disabled= “XXX” is set in the element, it is disabled regardless of why.
Native setting: + enable — dom.setattribute (“disabled”,”disabled”); Disabled – dom. RemoveAttribute (” disabled “); $(“#id”).attr(“disabled”,”disabled”); $(“#id”).removeAttr(“disabled”);