How to specify that the element is read-only in HTML?

HTMLWeb DevelopmentFront End Technology

To set an element to read-only, use the readonly attribute. You can try to run the following code to implement readonly attribute −

Example

<!DOCTYPE html>
<html>
   <body>
      <h2>Login</h2>
      <form action = "/new.php">
         <input type = "text" value = "Amit" name = "sname" readonly/><br>
         <input type = "password" name = "password"> <br><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>
raja
Published on 14-Mar-2018 14:42:00
Advertisements