Learn HTML - Text and password inputs

Опубликовано: 25 Февраль 2023
на канале: Konstantyn's coding
305
3

More info on input type text and input type password:
https://developer.mozilla.org/en-US/d...
https://developer.mozilla.org/en-US/d...

In this video, we'll be covering two important input types in HTML: text and password. These input types are used to collect user data on a webpage and they play a crucial role in web development.

Let's start with the text input type. This is used to collect text-based data from users, such as their name, email, or message. To create a text input, we use the HTML tag "input" with the 'type' attribute set to 'text'.

In this example, we've set the placeholder text to 'Enter your name'. This text will appear in the input field until the user starts typing. You can also set other attributes such as 'name', 'id', 'maxlength', and more.

And as you see there is a label element. This is a text, associated with particular input, or input's name. It has a 'for' attribute which should be the same as 'id' attribute of the input, otherwise they will not be related to each other.

Now, let's move on to the password input type. This is used to collect sensitive information from users, such as their password or PIN. To create a password input, we use the same 'input' tag, but with the 'type' attribute set to 'password'.

In this example, we've set the placeholder text to 'Enter your password'. When the user types in the field, the characters will be replaced with asterisks or bullets to hide the actual password. It's important to use the password input type for sensitive information because it ensures that the information is not visible to others who may be looking at the screen.