HTML <input> readonly eigenschap
Definitie en gebruik
readonly
De eigenschap bepaalt dat het invoerveld lees-only is.
readonly
De eigenschap is een booleaanse eigenschap.
Als deze eigenschap is ingesteld, bepaalt het dat het invoerveld lees-only is.
Lees-only invoervelden kunnen niet worden gewijzigd (maar de gebruiker kan het via de tabtoets vinden, het markeren en tekst eruit kopiëren).
can be set readonly
attribute to prevent the user from changing the value until certain other conditions are met (such as checking a checkbox, etc.). Then, JavaScript can delete readonly
value and make the input field editable.
Note:The form will still submit the read-only input field, but will not submit the disabled input field!
Example
An HTML form containing a read-only input field:
<form action="/action_page.php"> <label for="country">Country:</label> <input type="text" id="country" name="country" value="China" readonly><br><br> <input type="submit" value="Submit"> </form>
Syntax
<input readonly>
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |