How do we take password input in HTML forms?

HTMLWeb DevelopmentFront End Technology

To take password input in HTML form, use the <input> tag with type attribute as a password. This is also a single-line text input but it masks the character as soon as a user enters it.

Example

You can try to run the following code to take password input in HTML forms −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <head>
         <title>HTML Forms</title>
      </head>
      <p>Add your details:</p>
      <form>
         Student Username:<br> <input type="text" name="name">
         <br>
         Password:<br> <input type="password" name="password">
         <br>
      </form>
   </body>
</html>
raja
Published on 07-Feb-2018 12:46:46
Advertisements