I was working with HTML forms. In the forms I used readonly and disabled input elements. What is the deference between these two attributes of input element?
Say for I have an input element in HTML form.
If we set the attribute readonly="readonly" then the input element is not editable. This attribute allows the user to highlight and copy the text inside the input field, but not change the value.
This attribute is only used if the type attribute of the input element is set to “text” or “password”.
I have another text field like bellow.
If we set the attribute disabled="disabled", the input element is disabled, un-editable and un-selectable. This attribute not allow the users to highlight and copy the text inside the input field. Another thing happen here, the data within the input element will not be submitted to the action page.
Step two: Setting the form attributes
Now we set the form attributes like bellow