Answers for "javascript get all select options"

1

javascript get all select options

var options = document.getElementById('mySelectID').options;
for (let i = 0; i < options.length; i++) { 
  console.log(options[i].value);//log the value
}
Posted by: Guest on August-05-2019
2

javascript get all select options

//looping through options select with jQuery
$("#mySelectID option").each(function(){
    var thisOptionValue=$(this).val();
});
Posted by: Guest on August-05-2019

Code answers related to "javascript get all select options"

Code answers related to "Javascript"

Browse Popular Code Answers by Language