Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Creating Drop Downs | Working with Semantic Elements, Multimedia Elements and Graphics
HTML for Beginners
course content

Kursinhalt

HTML for Beginners

HTML for Beginners

1. Understanding Basic Elements
2. Working with Semantic Elements, Multimedia Elements and Graphics
3. Working with Advanced Elements

book
Creating Drop Downs

Sometimes when you create forms or input fields, you need to provide a set of options for the user to select. There are two ways to do this. Those use the <select> tag and <datalist> tag.

Select

<select> tags are generally used inside the forms because you want to process the value provided by the user in the backend.

The <select> tag itself doesn't provide any options. For that, you use <option> tags inside the <select> tag to specify the options you want to give the user.

html

index.html

copy

It's essential to give a value to the name attribute; otherwise, the data user selected will not be submitted after submitting the form.

You can use the required attribute with the <select> tag to make it mandatory to choose the select option when submitting the form.

Datalist

However, as you can see, <select> doesn't allow the user to type an answer he/she wants. Use the <datalist> tag.

Datalist tag also autocompletes your text. So when you press a specific letter inside the text box, it will only suggest options containing the letter types.

html

index.html

copy
Which of the following are attributes of the <select> tag?

Which of the following are attributes of the

Wählen Sie einige richtige Antworten aus

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 3
We're sorry to hear that something went wrong. What happened?
some-alt