input readonly - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

The readonly attribute creates text boxes that the user cannot edit.

The following code shows how to use the readonly Attributes.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <form method="post" action="http://example.com/form"> 
         <p> 
            <label for="name">
                Name: <!-- ww  w .  j  a  v a2s .  co m-->
               <input value="java2s.com" disabled id="name" name="name"> 
            </label> 
         </p> 
         <p> 
            <label for="city">
                City: 
               <input value="Boston" readonly id="city" name="city"> 
            </label> 
         </p> 
         <p> 
            <label for="fave">
                Fruit: 
               <input id="fave" name="fave"> 
            </label> 
         </p> 
         <button type="submit">Submit Vote</button> 
      </form>  
   </body>
</html>

Related Tutorials