Male Example 1 An example of implementing password input in HTML is as follows: "/> Male Example 1 An example of implementing password input in HTML is as follows: ">

Home >Web Front-end >HTML Tutorial >How can we enter password in HTML form?

How can we enter password in HTML form?

PHPz
PHPzforward
2023-09-17 14:33:041858browse

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.

How can we enter password in HTML form?

grammar

<form>
   <input type="password" name="name… " value=" ">Male
</form>

Example 1

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>

Example 2

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete