title: jQuery .hide is cancelled out when second script is ran
body: <p>I'm a little confused to how I can sort out this bug on my site.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>I have developed a filter for my website that displays and hides certain div's based on if they match the select element in my filter.</p>
  
  <p>When the first jQuery filter script is ran it work's fine, when I apply a second select element with a different jQuery script.</p>
  
  <p>Here is an example if you are confused to what I am nattering on about: <a href="http://screencast.com/t/DDKhQXQa0Y" rel="nofollow">http://screencast.com/t/DDKhQXQa0Y</a></p>
  
  <p>As you can see in the video if I select any one of the select elements it works fine, the problem is that when another select element is selected the first one is cancelled out. In my video example you can see that I select the makes and then select the min price element, when I selected the second one it cancelled out the Make filter.</p>
  
  <p><strong>My Code Setup:</strong></p>
  
  <p>First of all I will display the listing page code:</p>
  
  <pre><code>&lt;div class="makes ' . $row["Make"] . '"&gt;
          &lt;div class="listing-container"&gt;
            &lt;a href="carview.php?id='.$row["FullRegistration"].'"&gt;&lt;h3 class="model-listing-title clearfix"&gt;'.$row["Make"].' '.$row["Model"].' '.$row["Variant"].'&lt;/h3&gt;&lt;/a&gt;
            &lt;h3 class="price-listing"&gt;£'.number_format($row['Price']).'&lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="listing-container-spec"&gt;
           &lt;a href="carview.php?id='.$row["FullRegistration"].'"&gt;&lt;img data-original="'.(explode(',', $row["PictureRefs"])[0]).'" class="stock-img-finder lazy"/&gt;&lt;/a&gt;
            &lt;div class="ul-listing-container"&gt;
              &lt;ul class="overwrite-btstrp-ul"&gt;
                &lt;li class="diesel-svg list-svg"&gt;'.$row["FuelType"].'&lt;/li&gt;
                &lt;li class="saloon-svg list-svg"&gt;'.$row["Bodytype"].'&lt;/li&gt;
                &lt;li class="gear-svg list-svg"&gt;'.$row["Transmission"].'&lt;/li&gt;
                &lt;li class="color-svg list-svg"&gt;'.$row["Colour"].'&lt;/li&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
            &lt;ul class="overwrite-btstrp-ul other-specs-ul h4-style"&gt;
              &lt;li&gt;Mileage: '.number_format($row["Mileage"]).'&lt;/li&gt;
              &lt;li&gt;Engine size: '.$row["EngineSize"].'cc&lt;/li&gt;
            &lt;/ul&gt;
            &lt;button href="#" class="btn h4-style checked-btn hover-listing-btn"&gt;&lt;span class="glyphicon glyphicon-ok"&gt;&lt;/span&gt; History checked 
            &lt;/button&gt;
            &lt;a href="carview.php?id='.$row["FullRegistration"].'"&gt;&lt;button class="btn h4-style more-details-btn hover-listing-btn tst-mre-btn"&gt;&lt;span class="glyphicon glyphicon-list"&gt;&lt;/span&gt; More details 
            &lt;/button&gt;&lt;/a&gt;
            &lt;button href="#" class="btn h4-style test-drive-btn hover-listing-btn tst-mre-btn"&gt;&lt;span class="test-drive-glyph"&gt;&lt;/span&gt; Test drive 
            &lt;/button&gt;
            &lt;h4 class="h4-style listing-photos-count"&gt;&lt;span class="glyphicon glyphicon-camera"&gt;&lt;/span&gt; 5 More photos&lt;/h4&gt;
          &lt;/div&gt;
          &lt;/div&gt; 
  </code></pre>
  
  <p>As you can see this is using PHP PDO to retrieve the results from the DB and lists all of the vehicles.</p>
  
  <p>I then have my filter/form code block:</p>
  
  <pre><code>     &lt;form class="car-finder-container dflt-container"&gt;
           &lt;h2 class="h2-finder"&gt;Car finder&lt;/h2&gt;
           &lt;ul class="toggle-view"&gt;
             &lt;li class="li-toggle"&gt;
              &lt;h4 class="h4-finder-toggle"&gt;Make&lt;span class="glyphicon glyphicon-plus glyph-plus-toggle"&gt;&lt;/span&gt;&lt;/h4&gt;
              &lt;div class="panel"&gt;
               &lt;select name="make" class="form-control make-select select-box"&gt;
                   &lt;option value="make-any"&gt;Make (Any)&lt;/option&gt;
                   &lt;?php while($make = $makeFilter-&gt;fetch(PDO::FETCH_ASSOC)){
                   $selected = $make['Make'] == $_GET['make']?'selected="selected"':'';
                   echo '
                   &lt;option '.$selected.' value="'.$make["Make"].'"&gt;'.$make["Make"].'&lt;/option&gt;
                   ';
                   } ?&gt;
               &lt;/select&gt;
              &lt;/div&gt;
             &lt;/li&gt;
             &lt;li class="li-toggle"&gt;
              &lt;h4 class="h4-finder-toggle"&gt;Price Range&lt;span class="glyphicon glyphicon-plus glyph-plus-toggle"&gt;&lt;/span&gt;&lt;/h4&gt;
              &lt;div class="panel"&gt;
           &lt;select id="priceMax" class="select-box form-control price-min price-selector"&gt;
               &lt;option value="min-price"&gt;Min price&lt;/option&gt;&lt;option value="0"&gt;£0&lt;/option&gt;&lt;option value="500"&gt;£500&lt;/option&gt;&lt;option value="1000"&gt;£1,000&lt;/option&gt;&lt;option value="1500"&gt;£1,500&lt;/option&gt;&lt;option value="2000"&gt;£2,000&lt;/option&gt;&lt;option value="2500"&gt;£2,500&lt;/option&gt;&lt;option value="3000"&gt;£3,000&lt;/option&gt;&lt;option value="3500"&gt;£3,500&lt;/option&gt;&lt;option value="4000"&gt;£4,000&lt;/option&gt;&lt;option value="4500"&gt;£4,500&lt;/option&gt;&lt;option value="5000"&gt;£5,000&lt;/option&gt;&lt;option value="5500"&gt;£5,500&lt;/option&gt;&lt;option value="6000"&gt;£6,000&lt;/option&gt;&lt;option value="6500"&gt;£6,500&lt;/option&gt;&lt;option value="7000"&gt;£7,000&lt;/option&gt;&lt;option value="7500"&gt;£7,500&lt;/option&gt;&lt;option value="8000"&gt;£8,000&lt;/option&gt;&lt;option value="8500"&gt;£8,500&lt;/option&gt;&lt;option value="9000"&gt;£9,000&lt;/option&gt;&lt;option value="9500"&gt;£9,500&lt;/option&gt;&lt;option value="10000"&gt;£10,000&lt;/option&gt;&lt;option value="11000"&gt;£11,000&lt;/option&gt;&lt;option value="12000"&gt;£12,000&lt;/option&gt;&lt;option value="13000"&gt;£13,000&lt;/option&gt;&lt;option value="14000"&gt;£14,000&lt;/option&gt;&lt;option value="15000"&gt;£15,000&lt;/option&gt;&lt;option value="16000"&gt;£16,000&lt;/option&gt;&lt;option value="17000"&gt;£17,000&lt;/option&gt;&lt;option value="18000"&gt;£18,000&lt;/option&gt;&lt;option value="19000"&gt;£19,000&lt;/option&gt;&lt;option value="20000"&gt;£20,000&lt;/option&gt;&lt;option value="22500"&gt;£22,500&lt;/option&gt;&lt;option value="25000"&gt;£25,000&lt;/option&gt;&lt;option value="27500"&gt;£27,500&lt;/option&gt;&lt;option value="30000"&gt;£30,000&lt;/option&gt;&lt;option value="35000"&gt;£35,000&lt;/option&gt;&lt;option value="40000"&gt;£40,000&lt;/option&gt;&lt;option value="45000"&gt;£45,000&lt;/option&gt;&lt;option value="50000"&gt;£50,000&lt;/option&gt;&lt;option value="55000"&gt;£55,000&lt;/option&gt;&lt;option value="60000"&gt;£60,000&lt;/option&gt;&lt;option value="65000"&gt;£65,000&lt;/option&gt;&lt;option value="70000"&gt;£70,000&lt;/option&gt;&lt;option value="75000"&gt;£75,000&lt;/option&gt;&lt;option value="100000"&gt;£100,000&lt;/option&gt;&lt;option value="250000"&gt;£250,000&lt;/option&gt;&lt;option value="500000"&gt;£500,000&lt;/option&gt;
           &lt;/select&gt;
           &lt;select id="priceMin" class="select-box form-control price-max price-selector"&gt;
               &lt;option value="max-price"&gt;Max price&lt;/option&gt;&lt;option value="0"&gt;£0&lt;/option&gt;&lt;option value="500"&gt;£500&lt;/option&gt;&lt;option value="1000"&gt;£1,000&lt;/option&gt;&lt;option value="1500"&gt;£1,500&lt;/option&gt;&lt;option value="2000"&gt;£2,000&lt;/option&gt;&lt;option value="2500"&gt;£2,500&lt;/option&gt;&lt;option value="3000"&gt;£3,000&lt;/option&gt;&lt;option value="3500"&gt;£3,500&lt;/option&gt;&lt;option value="4000"&gt;£4,000&lt;/option&gt;&lt;option value="4500"&gt;£4,500&lt;/option&gt;&lt;option value="5000"&gt;£5,000&lt;/option&gt;&lt;option value="5500"&gt;£5,500&lt;/option&gt;&lt;option value="6000"&gt;£6,000&lt;/option&gt;&lt;option value="6500"&gt;£6,500&lt;/option&gt;&lt;option value="7000"&gt;£7,000&lt;/option&gt;&lt;option value="7500"&gt;£7,500&lt;/option&gt;&lt;option value="8000"&gt;£8,000&lt;/option&gt;&lt;option value="8500"&gt;£8,500&lt;/option&gt;&lt;option value="9000"&gt;£9,000&lt;/option&gt;&lt;option value="9500"&gt;£9,500&lt;/option&gt;&lt;option value="10000"&gt;£10,000&lt;/option&gt;&lt;option value="11000"&gt;£11,000&lt;/option&gt;&lt;option value="12000"&gt;£12,000&lt;/option&gt;&lt;option value="13000"&gt;£13,000&lt;/option&gt;&lt;option value="14000"&gt;£14,000&lt;/option&gt;&lt;option value="15000"&gt;£15,000&lt;/option&gt;&lt;option value="16000"&gt;£16,000&lt;/option&gt;&lt;option value="17000"&gt;£17,000&lt;/option&gt;&lt;option value="18000"&gt;£18,000&lt;/option&gt;&lt;option value="19000"&gt;£19,000&lt;/option&gt;&lt;option value="20000"&gt;£20,000&lt;/option&gt;&lt;option value="22500"&gt;£22,500&lt;/option&gt;&lt;option value="25000"&gt;£25,000&lt;/option&gt;&lt;option value="27500"&gt;£27,500&lt;/option&gt;&lt;option value="30000"&gt;£30,000&lt;/option&gt;&lt;option value="35000"&gt;£35,000&lt;/option&gt;&lt;option value="40000"&gt;£40,000&lt;/option&gt;&lt;option value="45000"&gt;£45,000&lt;/option&gt;&lt;option value="50000"&gt;£50,000&lt;/option&gt;&lt;option value="55000"&gt;£55,000&lt;/option&gt;&lt;option value="60000"&gt;£60,000&lt;/option&gt;&lt;option value="65000"&gt;£65,000&lt;/option&gt;&lt;option value="70000"&gt;£70,000&lt;/option&gt;&lt;option value="75000"&gt;£75,000&lt;/option&gt;&lt;option value="100000"&gt;£100,000&lt;/option&gt;&lt;option value="250000"&gt;£250,000&lt;/option&gt;&lt;option value="500000"&gt;£500,000&lt;/option&gt;
           &lt;/select&gt;
           &lt;/div&gt;
           &lt;/li&gt;
          &lt;/ul&gt;
           &lt;button href="#" class="btn btn-block car-search-button btn-lg btn-success"&gt;&lt;span class="glyphicon car-search-g glyphicon-search"&gt;&lt;/span&gt; Search cars 
           &lt;/button&gt;
           &lt;h4 class="h4-finder"&gt;&lt;a href="#"&gt;Try our Smart Search &lt;/a&gt;&lt;span class="glyphicon info-car-search-g glyphicon-info-sign"&gt;&lt;/span&gt;&lt;/h4&gt;
         &lt;/form&gt;
  </code></pre>
  
  <p>As you can see the first select element is using PHP to display it's options the second is just HTML.</p>
  
  <p>Now for the jQuery which is the actual problem.</p>
  
  <p>I have this block of code to hide the listing div's that don't have the same Make as the option selected:</p>
  
  <pre><code>$(document).ready(function(){
    $('.make-select').change(function(){
      var make = $(this).val();
      if(make != 'make-any'){
        $('.makes').hide();
        $('.'+make).show();
       } else {
         $('.makes').show();
      }
    });
    $('.make-select').trigger("change");
  });
  </code></pre>
  
  <p>It's fairly simple if the select value is not equal to the div class with 'makes' it is then hidden.</p>
  
  <p>I then have this block of code to display the 'makes' div based on the price displayed:</p>
  
  <pre><code>$('select').change(function () {
      var min = $('select.price-min').val();
      var max = $('select.price-max').val();
      $('div.makes').show();
      $('h3.price-listing').filter(function () {
          var price = +$(this).text().substring(1).replace(',', '');
          if (price &lt; min || price &gt; max) return true;
      }).closest('div.makes').hide();
  })
  </code></pre>
  
  <p>So that is the basic setup of my page.</p>
  
  <p>So as I mentioned earlier, why are my select elements cancelling out each other instead of apply both of the scripts?</p>
  
  <p>Thanks</p>