title: How to only display certain options in select tag?
body: <p>How do I only display certain options depending on the value in a select tag?</p>
  
  <pre><code> function key(id){
       var selectValue = document.getElementById('names').value
          = document.carmakes.cars.selectedIndex
          var selectOption = $("#names option:selected").val();
   }
  
  &lt;select size='5' name='carmakes' onchange='key(id)'&gt;
      &lt;option selected='selected' value="-1"&gt;Car makes&lt;/option&gt;
      &lt;option&gt;BMW&lt;/option&gt;
      &lt;option&gt;Audi&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select required='required' size='5' type='text' id='names'&gt;
  &lt;option selected="selected" value="0" &gt;Car names&lt;/option&gt;
  &lt;option value="1"&gt;X5&lt;/option&gt;
  &lt;option value="2"&gt;Q5&lt;/option&gt;
  </code></pre>