Home  >  Article  >  Web Front-end  >  Summary of several methods for setting text input boxes in form elements to be non-editable_javascript skills

Summary of several methods for setting text input boxes in form elements to be non-editable_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:12:341158browse

Code:

Copy code The code is as follows:


The input box cannot get focus and cannot be edited
The form can get the value.
Can be copied.
It’s quite strange, you’ve selected it, but you haven’t gained focus yet?

2,readonly

Code:

The input box is read-only. Cannot be edited
The same form can get the value.
Can also be copied.

3,disabled

Code:

Copy code The code is as follows:



The input box is gray and cannot be edited
You can use JS to change or get its value, but submit This value is not submitted when
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn