Answers for "js unselect all option select"

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
1

js clear all select options

for (var option of document.querySelectorAll('#DropList option'))
{ 
  option.remove();
}
Posted by: Guest on February-25-2022

Code answers related to "js unselect all option select"

Code answers related to "Javascript"

Browse Popular Code Answers by Language