We use the tag to receive password input in the HTML form by assigning password to the type attribute. When we enter the password, it immediately hides the characters. This is also a single line text input.
<form> <input type="password" name="name… " value=" ">Male </form>
An example of implementing password input in HTML is as follows:
<!DOCTYPE html> <html> <body> <head> <meta charset="UTF-8"> <meta name="description" content="meta tag in the web document"> <meta name="keywords" content="HTML,CSS"> <meta name="author" content="lokesh"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <p>Branch</p> <form> <input type="password" id="CSE" name="Branch" value="CSE" > <label for="CSE">Enter password</label> <br> <input type="password" name="Branch" value="IT" > <label for="CSE">Re-enter password</label> </form> </body> </html>
Another example of input as password is given below. You can try running the following code -
<!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>
The above is the detailed content of How can we enter password in HTML form?. For more information, please follow other related articles on the PHP Chinese website!