html tutorial - readonly Attribute in HTML - html5 - html code - html form

Readonly attribute in html

Learn html - html tutorial - Readonly attribute in html - html examples - html programs

  • The readonly attribute is used to specify the input field is read-only.
  • This is a Boolean attribute.

Syntax for readonly attribute in HTML:

<element readonly>

Applies To:

Element Attribute
<input> readonly
<textarea> readonly

Attribute Values:

Value Description
script The script can run on readonly

Sample Coding for readonly Attribute in HTML:

Tryit<!DOCTYPE html>
  <title>Wikitechy readonly  attribute</title>
       <input type="text" value="Wikitechy"  >
       <input type="text" value="Wikitechy" readonly >

Code Explanation for readonly Attribute in HTML:

readonly Attribute Code Explanation

  1. This <input> tag has the default value “Wikitechy”.
  2. This <input> tag has the default value “Wikitechy” and it also has the readonly attribute.

Output for readonly Attribute in HTML:

readonly Attribute Tag Output

  1. The output shows the both two textboxes has the value “Wikitechy”.
  2. readonly Attribute Tag Output

  3. When the user try to change the text to “Wikitechy Tutorials” First text box text has been changed but the second one not able to edit.

Browser Support for readonly Attribute in HTML:

1.0 6.0 1.0 1.0 1.0

Related Searches to readonly Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.