Answers for "get value from select multiple"

1

get value select 2

//get selected value
$('#mySelect2').find(':selected').val();
Posted by: Guest on January-27-2021
0

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);
}
Posted by: Guest on August-11-2020

Code answers related to "get value from select multiple"

Code answers related to "Javascript"

Browse Popular Code Answers by Language