title: Vehicle drop down selector
body: <p>Chasing some help on this one, unfortunately Javascript is not my forte; I am creating a simple drop down vehicle make, model and year selector which leads through to a link which is created dynamically depending on the users options selected.</p>
  
  <p>Effectively the user should be able to select a make and then have a model show up which is associated with that make and finally a year that is associated with the model selected. I have been able to get the make and model selection to work but when I attempt the same thing by adding in the year it starts showing the year in place of the model.</p>
  
  <p>Can someone please assist with this? My code is below along with a link to the fiddle.</p>
  
  <p><a href="http://jsfiddle.net/Yash91/qtd7patd/" rel="nofollow noreferrer">http://jsfiddle.net/Yash91/qtd7patd/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function showURL() {
      var d1 = $("#make").find(":selected").attr("class");
      var d2 = $("#model").find(":selected").attr("class");
      var d3 = $("#year").find(":selected").attr("class");
      var url = ("http://www.web.com.au/" + d1 + "/" + d2 + "/" + d3);
      window.location = url;
      return true;
  }
  
  $(document).ready(function() {
  var $make = $( '#make' ),
    $model = $( '#model' ),
      $options = $model.find( 'option' );
      
  $make.on( 'change', function() {
   $model.html( $options.filter( '[value="' + this.value + '"]' ) );
  } ).trigger( 'change' );
  
  var $model = $( '#model' ),
    $year = $( '#year' ),
      $options = $year.find( 'option' );
      
  $model.on( 'change', function() {
   $year.html( $options.filter( '[value="' + this.value + '"]' ) );
  } ).trigger( 'change' );
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!-- Vehicle Brand Selector List --&gt;
  &lt;select name="make" id="make"&gt;
   &lt;option class="vehicle-search" value="0"&gt;Make&lt;/option&gt;
   &lt;option class="vehicle-search" value="1"&gt;BMW&lt;/option&gt;
   &lt;option class="vehicle-search" value="2"&gt;Daewoo&lt;/option&gt;
   &lt;option class="vehicle-search" value="3"&gt;Ford&lt;/option&gt;
   &lt;option class="vehicle-search" value="4"&gt;Holden&lt;/option&gt;
   &lt;option class="vehicle-search" value="5"&gt;Honda&lt;/option&gt;
   &lt;option class="vehicle-search" value="6"&gt;Hyundai&lt;/option&gt;
   &lt;option class="vehicle-search" value="7"&gt;Isuzu&lt;/option&gt;
   &lt;option class="vehicle-search" value="8"&gt;Kia&lt;/option&gt;
   &lt;option class="vehicle-search" value="9"&gt;Lexus&lt;/option&gt;
   &lt;option class="vehicle-search" value="10"&gt;Mazda&lt;/option&gt;
   &lt;option class="vehicle-search" value="11"&gt;Mitsubishi&lt;/option&gt;
   &lt;option class="vehicle-search" value="12"&gt;Nissan&lt;/option&gt;
   &lt;option class="vehicle-search" value="13"&gt;Peugeot&lt;/option&gt;
   &lt;option class="vehicle-search" value="14"&gt;Subaru&lt;/option&gt;
   &lt;option class="vehicle-search" value="15"&gt;Suzuki&lt;/option&gt;
   &lt;option class="vehicle-search" value="16"&gt;Toyota&lt;/option&gt;
   &lt;option class="vehicle-search" value="17"&gt;Volkswagen&lt;/option&gt;
  &lt;/select&gt;
  &lt;!-- Vehicle Model List --&gt;
  &lt;select name="model" id="model"&gt;
   &lt;option value="0"&gt;Model&lt;/option&gt;
   &lt;option class="318i" value="1"&gt;318i&lt;/option&gt;
   &lt;option class="lanos" value="2"&gt;Lanos&lt;/option&gt;
   &lt;option class="courier" value="3"&gt;Courier&lt;/option&gt;
   &lt;option class="falcon" value="3"&gt;Falcon&lt;/option&gt;
   &lt;option class="festiva" value="3"&gt;Festiva&lt;/option&gt;
   &lt;option class="fiesta" value="3"&gt;Fiesta&lt;/option&gt;
   &lt;option class="focus" value="3"&gt;Focus&lt;/option&gt;
   &lt;option class="laser" value="3"&gt;Laser&lt;/option&gt;
   &lt;option class="ranger" value="3"&gt;Ranger&lt;/option&gt;
   &lt;option class="territory" value="3"&gt;Territory&lt;/option&gt;
   &lt;option class="astra" value="4"&gt;Astra&lt;/option&gt;
   &lt;option class="barina" value="4"&gt;Barina&lt;/option&gt;
   &lt;option class="captiva" value="4"&gt;Captiva&lt;/option&gt;
   &lt;option class="colorado" value="4"&gt;Colorado&lt;/option&gt;
   &lt;option class="commodore" value="4"&gt;Commodore&lt;/option&gt;
   &lt;option class="cruze" value="4"&gt;Cruze&lt;/option&gt;
   &lt;option class="rodeo" value="4"&gt;Rodeo&lt;/option&gt;
   &lt;option class="viva" value="4"&gt;Viva&lt;/option&gt;
  &lt;/select&gt;
  &lt;!-- Vehicle Year List --&gt;
  &lt;select name="year" id="year"&gt;
   &lt;option value="0"&gt;Year&lt;/option&gt;
   &lt;option class="1998-2005" value="1"&gt;1998-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="2"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="3"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
   &lt;option class="1997-2005" value="4"&gt;1997-2005&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="submit" name="button" id="button" onclick="showURL();" /&gt;</code></pre>
  </div>
  </div>
  </p>