Text input non-editable

If you ever need to make an input field or textarea non-editable the readonly attribute comes in very handy.

When the readonly attribute is present in the markup, it specifies that the user will not be able to modify the value. However the user will still be able to tab to it and copy the text.


<input type="text" name="input" value="Web Design Weekly Rocks!" readonly>

Note: The readonly attribute is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type.

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *

Current ye@r *