EN
HTML - readonly input
3 points
In this article, we would like to show you how to create readonly input element in HTML.
Quick solution:
xxxxxxxxxx
1
<input value="Example text..." readonly />
or
xxxxxxxxxx
1
<input value="Example text..." readonly="readonly" />
In this example, we use the input
element's readonly
attribute to create read-only input
or textarea
that can't be changed by the user (however it can be highlighted to copy the text).
xxxxxxxxxx
1
2
<html>
3
<body>
4
<div>Text:</div>
5
<input type="text" value="Example text..." readonly />
6
7
<div>Date:</div>
8
<input type="date" value="2021-01-01" readonly />
9
10
<div>Email:</div>
11
<input type="email" value="example.user@email.com" readonly />
12
13
<div>Password:</div>
14
<input type="password" value="some_password_here" readonly />
15
16
<div>Multiline-text:</div>
17
<textarea readonly>Example text...</textarea>
18
</body>
19
</html>