English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die readonly-Eigenschaft des input-Elements ist ein boolesches Attribut. Wenn es vorhanden ist, wird das Eingabefeld als lesend festgelegt. Setzen Sie die readonly-Eigenschaft, um zu verhindern, dass der Benutzer den Wert ändert, bis andere Bedingungen erfüllt sind.
HTML-Formular mit lesendem Eingabefeld:
<!DOCTYPE html> <html> <head> <title>HTML:<input> readonly-Eigenschaft - Grundlagen-Tutorial-Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> E-Mail: <input type="text" name="email"><br> Land: <input type="text" name="country" value="Norway" readonly><br> <input type="submit" value="Submit"> </form> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the readonly attribute.
The readonly attribute is a boolean attribute.
If present, specifies the input field as read-only.
Read-only input fields cannot be modified (but users can tab through them, highlight, and copy text from them).
You can set the readonly attribute to prevent users from changing the value until certain conditions are met (such as checking a checkbox, etc.). Then, JavaScript can remove the read-only value and make the input field editable.
Note:Forms will still submit read-only input fields, but will not submit disabled input fields!
None.
In XHTML, attribute abbreviation is prohibited, the readonly attribute must be defined as <input readonly="readonly" />。
<input readonly>HTML <input> Tag