"readonly" attribute stops the user from changing the
content, but doesn’t stop the user from interacting with the form
control content. It’s still possible to click inside the
textarea, tab to it, highlight the text inside it, and
even to copy and paste that content—it just can’t be changed.
most likely application for this attribute is to stop the user from
interfering with the content inside a
such a time as some other condition has been met (for example, a checkbox
is checked to confirm the user’s acceptance of terms and conditions). At
"readonly" value, making the form control completely
readonlyattribute below prevents the
textareacontent from being changed:
<form> <label for="perfectday">Describe your perfect day:</label> <textarea id="perfectday" readonly="readonly" name="perfectday" accesskey="d" cols="40" rows="10"> Sitting by the beach, sipping a cocktail</textarea> <input type="submit" value="Tell us"/> </form>
"readonly" is the
only possible value for this attribute.
It causes no compatibility issues, and has excellent support across all tested browsers.
There are no comments yet.