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

How can we enter password in HTML form?

PHPz
Release: 2023-09-17 14:33:04
forward
1861 people have browsed it

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>
Copy after login

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>
Copy after login

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template