The difference between readonly and disabled in a form:
ReadOnly is only valid for input (Text/password) and textarea, and disabled is valid for all form elements, including Select,radio, CheckBox, button, and so on.
However, after the form element is used disabled, the value of this element is not passed out when we submit the form as post or get. and ReadOnly will pass the value out (this happens when we set the TEXTAREA element in a form to Disabled or readonly, but Submitbutton is available).
JS Operation:
Copy Code code as follows:
function Disableelement (element,val) {
document.getElementById (Element). Disabled=val;
}
jquery for operations:
Copy Code code as follows:
Two ways to set the Disabled property
$ (' #areaSelect '). attr ("Disabled", true);
$ (' #areaSelect '). attr ("Disabled", "disabled");
Three ways to remove the disabled property
$ (' #areaSelect '). attr ("disabled", false);
$ (' #areaSelect '). Removeattr ("Disabled");
$ (' #areaSelect '). attr ("Disabled", "");
Gets the S:textfield and sets its disabled property:
Copy Code code as follows:
Functiondisabletextfieldofaccountdiv (element,val) {
$ (Element). Find (": TextField"). attr (' disabled ', Val);
}