how to get values from select multiple in js

document.getElementById('submit').onclick = function() {
  var selected = [];
  for (var option of document.getElementById('pets').options) {
    if (option.selected) {
      selected.push(option.value);
    }
  }
  alert(selected);
}

3.83
6
Mukesh kumar 100 points

                                    const selected = document.querySelectorAll('#select-meal-type option:checked');
const values = Array.from(selected).map(el => el.value);

3.83 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to get values from select multiple in js get multi select values in javascript get multiple selected values select box javascript select multiples integer javascript select multiple js select multiple values from dropdown in javascript select multiple using value in select in js html select option multiple values javascript js multiple select values get value from select multiple how to get values from multiple select in javascript get multiple item selected of select tag js selecting multiple elements javascript select mutiple value in javascript get select with multiple data js how to get multiple select javascript get values of multiple select in js how do you select multiple elements in js get value from multiple select box woth same name in javascript list multiple values in select option using js récupérer value select multiple javascript get value from multiple select javascript multi select value get in js js get multi select values how to get multiple combobox value in javascript how to select multiple options in javascript select tag multiple values javascript get multiple values from select javascript select multiple options in javascript select multiple items javascript javascript set multiple select values select multiple element in javascript getting all the values from select muliple javascript select multiple javascript how to get the value of a mutiple selection select in js get value inside of multi select form javascript select multiple values javascript how to select multiple items javascript get select values of select multiple js how to get value of multiple select in javascript select multiple element with javascript get multiple select value in javascript javascript selected 2 values multiselect get multiple selected values in javascript from select tag js select multiple values select item in multiple javascript get value of multiple select select dropdown selected multiple value js javascript multiselect get selected values javascript multi select values get value of multiple select javascript get values from two selected javascript how to get value of selected option in javascript for multiple in select tag how to get value of selected option in javascript for multiple js two select how get the values both javascript multiple select sub values html get values from multiple select dom select multiple values js multiple select get value attributes javascript get multiple options in select select multiple val in js select multiple values in js for selct2 how to select data on multiple in js get value from multiple dropdown in javascript get value from multiple select box in javascript how to get the multiple selected value of dropdown in javascript javascript select multiple values in array select2 js multiple get values selected multiple select values javascript select multiple elements javascript get items of multiple select javascript get the items in multiple select element javascript how to select one or multiple elements in javascript how to select multiple elements in javascript multiple values in row select in js js select multiple get values how to map the select options in javascript javascript select multiple elements javascript filter multiple values javascript return multiple values multiselect option value javascript javascript get select multiple values javascript multi select dropdown get selected values in sequence get multiple selected value js multi select values in javascript multiple select get values multiple select javascript how to select based on multiple attributes in js html multiselect get values multi select dropdown value in javascript javascript select multiple values get select2 multiple selected values by js get all selected values from multiple select javascript get click multiselect option value in javascript click option multiselect value in javascript javascript get multiple select values how to get the items in a multiple select html through javascript select option multiple values javascript how to show number of selected option as a value in multi select javascript switch with multiple conditions how to get multiple select value in javascript javascript multiple select input based on previous selection javascript mulitple select input based on previous selection How to display multiple values with multiple sub value in js js get all selection elements ultipl slect option js javascript list multiple variables in one statement how to get element from multi selector in javascript how to get values in select with multiple in html how to get values of multiple select in javascript get values select multiple javascript javascript select multiple values from array get values of multiple select in javascript get multiselection data in node how to select multiple text values javascript js select multiple elements selected multiple selected value javascript select multiple value swith multiple values js how to set multi select dropdown value in javascript get particular selected item from select multiple box how to extract selected option from select multiple in js select multiple html get values html select multiple get values get value multiple select option javascript pure javascript get value select multiple javascript select value multiple get values from select multiple javascript options multiple selected values only RETURN MULTIPLE SELECTED ITEMS IN AN ARRAY JAVASCRIPT multiple select dropdown get value js js get multiple select values vanila select box readding the list everytime how to get selected values from multi select dropdown in javascript how to get multiple select values javascript get value of multiple select html select multiple show selected js select multiple how to select values from multiple getelementbyid how to select multiple getelementbyid values multiple select value in javascript get multiple select option value in javascript javascript list multiple selection reading mustiselect value html how to get all selected values from dropdown in javascript multiple select box selected values javascript select multiple entries from a dropdown in js how to get multiple selected values from dropdown in javascript js get multiselect values javascript select get all selected get multiselect values in javascript html select multiple values javascript display multiple selected items in javascript how to handle multiple selected options how to handle multiple select input javascript multi select value in input javascript from array select by multiple data value get selectes number from multiple number in html how to get multiple selected option value in javascript read select multi js how to collect options from multi select javascript how to get values selected in html multi select on button click get selected value of multiselect dropdown in javascript get array of selected options from select element get the value selected by a multiple select in javascript get the value by a multiple select in javascript javascript - select multiple values vanilla js alert with multiples options javascript get the selected option value of multiple dropbox javascript get the selected option value of multiple handle multiple list in javascript get multiple select values javascript html get value of multiple select javascript check multiple html data javascript check multiple html values get all selected in multiselect html jquery get all selected in multiselect html js js how show multiselect values html javascript get all selected options js get all values from multiple select how to get multiple selected values of select box in javascript multiple select value js js seleced multiple selected get all selected multiselect list options value document.getElement select list multiple javascript vanilla get selected options multiple javascript get selected options multiple multi select get value javascript javascript get all selected options select value in multiple javascript elements selected in multiselect how to select multiple values in javascript js check for two different values in an select inout
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source