👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
As you will learn how to create web forms, one of the most common tasks is getting values ​​from drop - down menus. In this article, we are going to learn how to get these values ​​with JavaScript.
Let’s take a quick rundown on how to create a dropdown element using HTML. Follow my Codepen if you get lost.
to build our drop down element we need to use the select
and use the option children nested below. The selection element creates the drop-down menu and with the option tags we set these options in the drop-down menu live on.
Let’s create a dropdown menu of our favorite fruits (which have emojis).
we have added an empty h2 that we will fill in with JavaScript later. At this point you can choose your favorite fruit:
