Home>Article>Web Front-end> How to set javascript to be non-editable
In javascript, you can use the disabled attribute of the Checkbox object to set it to be non-editable. You only need to set the value of the disabled attribute of the specified element tag to "true". The syntax format is "element object.disabled=true; ".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript-Set the text box to be non-editable
We need to first create an HTML skeleton, which can be quickly generated by the compiler.
Then we enter the basic content.
Then the next step is to write JavaScript events to implement the disabling function
Optimize it: enter numbers in the text box, and after clicking disable, you will no longer be able to enter numbers in the text box, and then continue Just write the "enable" function. In fact, enabling functions is almost the same as disabling functions. Just change "disabled = true" to "disabled = false". The code is as follows:
[Related recommendations:javascript learning tutorial】
The above is the detailed content of How to set javascript to be non-editable. For more information, please follow other related articles on the PHP Chinese website!