FAQ: Learn HTML: Forms - Dropdown list

This community-built FAQ covers the “Dropdown list” 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 Dropdown list

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!

why do we need to create id atrribute

So the user can see the input area attached to the description text. Notice how when you click on “What type of bun would you like?”, the dropdown box highlights.

I tried using the strong and em tags to format the text that is displayed in the drop-down by nesting these tags under the option tag, but it does not seem to work. How can i format the individual elements in the drop-down?

So if we don’t select any option, the first option will be selected by default?
If yes, then is there any way to stop it?

For eg: If in the excercise if we don’t select any option then by I think “sesame” will be selected by default. Is there any way we can set another option, say “select any one” as default which does not allow progression if we don’t select any one of the options prrovided.

Attributes are very useful to customize behavior, in this case you need to use selected attribute: