Generally, some hidden attributes are placed on some form submission pages.
For example, when modifying a record, the id of the record is embedded in the editing window.
On the display interface, you sometimes need to set the input or select box to disable to avoid modification.
Hidden in the following code does not work normally in IE
Copy codeThe Code is as follows:
<Input name = "role_name" id = "role_name" value = "Roy" disabled>
<Input name = "role_id" id = "role_id" hidden value = "3312">
Additional value should be added to standard writing.
Copy codeThe Code is as follows:
<Input name = "role_name" id = "role_name" value = "Roy" disabled = "disabled">
<Input name = "role_id" id = "role_id" hidden = "hidden" value = "3312">
Sometimes we need to edit the above two items on the current page. What should we do?
We can use
Copy codeThe Code is as follows:
$ ("# Role_name"). removeAttr ("disabled ");
$ ("# Role_id"). removeAttr ("hidden ");
Or
Copy codeThe Code is as follows:
$ ("# Role_name"). prop ("disabled", false );
$ ("# Role_id"). prop ("hidden", false );
$ ("# Role_name"). prop () returns a boolean value to check whether the property prop () method is enabled and whether the option is selected in the checked option.
Generally, prop () takes effect only when the write attribute name is used and boolean is used to control the attribute status.