This time I will show you how to set the input to read-only effect through disabled and readonly, and set the input to read-only effect through disabled and readonly. What are the precautions?, the following is a practical case, Let’s take a look.
There are two ways to achieve the read-only effect of input: disabled and readonly.
Of course the two effects can only be read but not edited, but they are very different.
Disabled indicates that the input is invalid and its value will not be passed to any program, such as asp, php, etc.
Readonly only cannot be edited and does not affect the transfer of its value.
Disabled使用:<INPUT type="text" name="username" value="james" disabled> Readonly使用:<INPUT type="text" name="partNumber" value="1500" readonly>
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
How to use the href attribute and onclick event of a tag
How to use marquee to implement text in html Scroll left and right
How to add styles to images for radio and multi-select buttons
Button has several Click response methods
There are several ways to disable form controls in HTML
The above is the detailed content of How to set input to read-only through disabled and readonly. For more information, please follow other related articles on the PHP Chinese website!