javascript get all selected options code example
Example 1: jquery get all select options
//looping through options select with jQuery
$("#mySelectID option").each(function(){
var thisOptionValue=$(this).val();
});
Example 2: get array of selected options from select element
var values = $('#select-meal-type').val();
Example 3: javascript get all options from select
x.options.length
Example 4: javascript select multiple values
const selected = document.querySelectorAll('#select-meal-type option:checked');
const values = Array.from(selected).map(el => el.value);