input disabled - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

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

The following code shows how to use the disabled 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: <!--from  w  w w . java 2s.c  o  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