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:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#Examples

1 Like

According to Interneting Is Hard, a great tutorial on HTML/CSS, styling a dropdown menu is extremely hard. It recommends using Bootstrap or jQuery to customize a dropdown menu.

Why does the picture of the code below show two arrows, an up and a down one? Shouldn’t it be just a down one? Also, is there a way to send feedback directly to codeacademy? I think giving the option for people to provide feedback when they encounter something wrong would be beneficial for them.
image

Is it ok to create a “None” option if the user didn’t want any of the options from the drop down list.
E.g None

sure, just set the value attribute to an empty string

Why does select not require an input tag?

if I wanted to make more than one item on the drop down list clickable how would I do this or is there a more compacted way of doing this without using checkboxes

using <select> element:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select

you have a multiple attribute, which, well i suppose you can guess what it does :wink:

1 Like