How to select more than one option in drop down menu? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to select more than one option in drop down menu?

When we create drop down menu, we can select only one option of many given options. My question is how we can create a drop down menu, in which, we can select multiple options??? What is the code syntax for it?? Also, what is the role of value and name attribute in form? Thanks in advance.

7th Mar 2020, 8:27 PM
Himanshu Rai
Himanshu Rai - avatar
1 Answer
+ 3
Use 'multiple' attribute to enable multiple selection in a drop down menu. A little bit of Javascript is needed to collect selected options. About 'name' and 'value', form don't use this. Form entries on the other hand use this pair of attribute as metadata for the back-end. The 'name' and 'value' defines a data identity and its value. These are submitted to the back-end when the form is submiitted. https://code.sololearn.com/WiOPehRDQrCC/?ref=app
7th Mar 2020, 11:39 PM
Ipang