1var options = document.getElementById('mySelectID').options;
2for (let i = 0; i < options.length; i++) {
3 console.log(options[i].value);//log the value
4}
1//looping through options select with jQuery
2$("#mySelectID option").each(function(){
3 var thisOptionValue=$(this).val();
4});
1//u have to put a unique id on your html select tag!
2var options = document.getElementById('mySelectID'). options;
3/*u can use this istead if u dont have an id in your select,
4if u have only 1 select in your html*/
5var options = document.querySelector('select').options;
6
7//options.length gives the array dimension of var options
8for (let i = 0; i < options. length; i++) {
9//log the value.
10console. log(options[i]. value);
11}
1// This will select all of the text in the textarea or input called element
2element.select();