1document.getElementById('submit').onclick = function() {
2 var selected = [];
3 for (var option of document.getElementById('pets').options) {
4 if (option.selected) {
5 selected.push(option.value);
6 }
7 }
8 alert(selected);
9}
10
1const selected = document.querySelectorAll('#select-meal-type option:checked');
2const values = Array.from(selected).map(el => el.value);