title: Make a drop down menu required depending the selection of previous drop down
body: <p>I have a successful piece of javascript that when selecting from a drop down menu makes a text box or text area required. It however does not work with another drop down box. Any help would be appreciated. </p>
  
  <p>Example: When selecting "Collection" from the first drop down, the drop down "Number_of_parcels" (which is always visible), becomes required. Nothing changes when selecting "Delivery" etc. I am stumped and any help would be appreciated.</p>
  
  <pre><code>JAVASCRIPT
  function selection()
  {    
   var cat = document.getElementById('Collection_Delivery').value;    
      if (cat == "Collection") {
          if (document.getElementById("Number_of_parcels").value == "") {
              alert('This must be completed');
              return false;
          }
  
      }
      return true;
  }
  
  
  HTML first drop down:
  &lt;select name="Collection_Delivery" id="Collection_Delivery"     onChange="selection()"&gt;
        &lt;option disabled="disabled" selected="selected"&gt;-&lt;/option&gt;
        &lt;option value="Delivery"&gt;Delivery&lt;/option&gt;
        &lt;option value="Collection"&gt;Collection&lt;/option&gt;
        &lt;option value="Collection and Delivery"&gt;Collection &amp;amp Delivery&lt;/option&gt;
      &lt;/select&gt;
  
  HTML second drop down:
  &lt;select name="Number_of_parcels" id="Number_of_parcels"&gt;
        &lt;option value="" selected="selected"&gt;Please select&lt;/option&gt;
        &lt;option value="1"&gt;1&lt;/option&gt;
        &lt;option value="2"&gt;2&lt;/option&gt;
        &lt;option value="3"&gt;3&lt;/option&gt;
        &lt;option value="4"&gt;4&lt;/option&gt;
        &lt;option value="5"&gt;5&lt;/option&gt;
        &lt;option value="6"&gt;6&lt;/option&gt;
        &lt;option value="7"&gt;7&lt;/option&gt;
        &lt;option value="8"&gt;8&lt;/option&gt;
        &lt;option value="9"&gt;9&lt;/option&gt;
        &lt;option value="10"&gt;10&lt;/option&gt;
      &lt;/select&gt;
  
  &lt;input type="submit" value="Send" onClick="return checkForm(this.form);selection()" name="myButton"&gt;
  </code></pre>