title: jQuery - Unrecognized Expression when passing variable to selector
body: <p>I'm trying to use a <code>&lt;select&gt;</code>-element to display different image sliders according to the selected option. I'm totally aware that there might be better ways to do this but since performance doesn't matter in this case I think the following might be the easiest option.</p>
  
  <p>This is the HTML:</p>
  
  <pre><code>&lt;select id="album-select"&gt;
      &lt;option value="album1" selected="selected"&gt;Album 1&lt;/option&gt;
      &lt;option value="album2"&gt;Album 2&lt;/option&gt;
      &lt;option value="album3"&gt;Album 3&lt;/option&gt;
      &lt;option value="album4"&gt;Album 4&lt;/option&gt;
  &lt;/select&gt;
  &lt;ul id="album1-slides" class="rslides"&gt;
      &lt;li&gt;&lt;img src="img/album/1.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/2.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/3.jpg" alt=""&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul id="album2-slides" class="rslides"&gt;
      &lt;li&gt;&lt;img src="img/album/4.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/5.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/6.jpg" alt=""&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul id="album3-slides" class="rslides"&gt;
      &lt;li&gt;&lt;img src="img/album/7.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/8.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/9.jpg" alt=""&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul id="album4-slides" class="rslides"&gt;
      &lt;li&gt;&lt;img src="img/album/10.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/11.jpg" alt=""&gt;&lt;/li&gt;
      &lt;li&gt;&lt;img src="img/album/12.jpg" alt=""&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I'm using <a href="http://responsive-slides.viljamis.com/" rel="nofollow">Responsive Slides</a>, though that doesn't really matter since it works flawlessly. Just in case you are wondering about the <code>&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;</code>-structures.</p>
  
  <p>All <code>&lt;ul&gt;</code>-elements have <code>display: none</code> assigned via CSS.</p>
  
  <p>And this is my JavaScript/jQuery code:</p>
  
  <pre><code>&lt;script&gt;
  
  $(document).ready(function() {
  
            $("#album1-slides").show();
  
            function changeGallery(gallery) {
                 $(".rslides").hide();
                 var newGallery = "\"" + gallery + "-slides" + "\"";
                 $(newGallery).show();
            }
  
            $("#album-select").change(function() {
                 var gallery = "#" + $("#album-select").val();
                 changeGallery(gallery);
            });
  
       });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>So, when I open the page the first album is automatically displayed. When changing the selected <code>&lt;option&gt;</code> it should hide the displayed album (by hiding all of them since this is the fastest way) and display the new one.</p>
  
  <p>I don't know what the problem is, but when I try it, I get the following error in the console:</p>
  
  <pre><code>Uncaught Error: Syntax error, unrecognized expression: "#album2-slides"
  </code></pre>
  
  <p>Which makes no sense to me because this is exactly the selector I want to have in my <code>$(selector).show();</code>. I guess it has something to do with the quotes but googling didn't help me.</p>
  
  <p>I'm using jQuery 1.9.1.</p>
  
  <p>Thank you in advance for any suggestions and solutions! :)</p>