title: Jquery or Javascript remove from combobox all option except one
body: <p>I'd like you to help me with this please, I'd like to remove all options from a combobox except the one with value=3. I have this code but is not working. </p>
  
  <pre><code>&lt;select id="Select1" name="Select1"&gt;
      &lt;option selected value="1"&gt;Pink&lt;/option&gt;
      &lt;option value="2"&gt;Black&lt;/option&gt;
      &lt;option value="3"&gt;Green&lt;/option&gt;
      &lt;option value="4"&gt;Blue&lt;/option&gt;
      &lt;option value="5"&gt;White&lt;/option&gt;
  &lt;/select&gt;
  
  
  &lt;input type="button" onclick="myFunction()" value="Remove option"&gt;
  
  &lt;script&gt;
      function myFunction() {
          var select=document.getElementById('Select1');
  
          for (i=0;i&lt;select.length;  i++) {
             if (select.options[i].value!=document.getElementById('TextBox1')) {
               select.remove(i);
             }
          }
      }
  &lt;/script&gt;
  </code></pre>