FAQ: Learn HTML: Forms - Password Input

This community-built FAQ covers the “Password Input” exercise from the lesson “Learn HTML: Forms”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction to HTML

FAQs on the exercise Password Input

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Is there a way to chose between * or • displayed on the input box when writing?

In this exercise we have seen how to hide on our screen the input password. By the way after the commit of the form password will be sended as plain text. If I want to encrypt it , how can I do ?

Why must there be a “name” and “for” attribute? Can’t the code work without them?

use https (s is for secure, it uses ssl encryption with certificates)

for associates a label with an input element. This is needed for people who use disability tools.

name is used to associate the input field with the data send to the server.


What difference are there between name and id attribute?

1 Like

the for attribute uses the id to associate input field and label, the id also can be used for styling

In the explanation of Adding a Label, we found <input type=“text” name=“x” id=“x”>. In the explanation of Password Input, we found <input type=“password” id=“x” name=“x”>. While in “Number Input,” we found <input id=“x” name=“x” type=“number” step=“x”>

My question is, why in Adding a Label, the name attribute comes before the id attribute, different from in Password Input which the name attribute comes after the id attribute and also their structure of the use type, name, id different from the Number Input structure?

Structurally, is it that way? Thanks!

1 Like

attribute order is irrelevant, you could use any order you like

Although I understand that the attribute order is irrelevant in terms of execution order and rendering on the HTML page. Yet in previous lessons we are taught about readability of the code and common practice. Surely there is some guideline on the order of attributes ? Or at least an order to agree on.
Type / Name / ID / etc ?

Thank you for any extra clarification.

yes, unfortunately, there is no guidance, so you choice your own order if you work alone, or choice an order for the attributes when working in a team and then sticking to them

Do “id”, “name” and “for” attributes require the same name ?

id and for should have the same name, given this associates the label with the input element. name doesn’t have to be the same, but i quite often do, because you want to have a logic name (one that make sense for the input field)

1 Like