r/HTML • u/Acrobatic_Ad_2992 • 13h ago
Question Get Selected Values from Select Tag “multiple” HTML/JavaScript
I created a select tag in HTML and gave it multiple size=“1” to get a drop down multi select element on my website. The element works exactly how I want it to however, I have no idea how to get the selected values in JavaScript. If I use .value to get the value like I would in a select tag it will give me the value like normal if only 1 option is selected, and will give me undefined if none are selected but if multiple options are selected it returns a bunch of information I don’t understand how to parse.
Please help teach me how to get the selected values from my HTML multiple select tag in JavaScript.
Also if this isn’t a good subreddit for this post please help me find somewhere that could help me.

