Answers for "js select get all options value"

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
1

js select get all options value

$("#mySelectID option").toArray().map(p=>p.value)
Posted by: Guest on May-03-2022

Code answers related to "js select get all options value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language