title: Getting the selected values in a multiselect tag in Javascript
body: <p>I have the following code </p>
  
  <pre><code>function searchFlights() {
      var select1 = document.getElementById("airports-select-1");
      var selected1 = [];
      while(select1.selectedIndex != -1) {
        if(select1.selectedIndex != 0) selected1.push(select1.options[select1.selectedIndex].value); 
        select1.options[select1.selectedIndex].selected = false;
     }
  
     console.log(selected1);
  }
  </code></pre>
  
  <p>This works right, but as you can see from the code this line: </p>
  
  <pre><code>select1.options[select1.selectedIndex].selected = false;
  </code></pre>
  
  <p>Is doing a deselecting of the value. </p>
  
  <p>Now, I do not want to deselect the values. If I uncomment that line in the code, the code will run forever. </p>
  
  <p>Is there any more refined and sophisticated solution for retrieving multiple values from a select tag using Javascript?</p>