input readonly Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The readonly attribute is a boolean attribute to set if an input field is read-only.

A read-only input field cannot be modified but user can tab to it, highlight it, and copy the text from it.

In XHTML, the readonly attribute must be defined as <input readonly="readonly" />.

An HTML form with a read-only input field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Email: <input type="text" name="email"><br>
  Country: <input type="text" name="country" value="Norway" readonly><br>
  <input type="submit" value="Submit">
</form><!--  ww w . j  a v a 2s .  c om-->

</body>
</html>

Related Tutorials