title: passing dynamic values as id in jquery function
body: <p>I'm trying to pass the dynamic values to the jquery function. </p>
  
  <p>this code will work perfectly fine:(when I passing the particular id itself)</p>
  
  <pre><code>$('#slidedown').click(function () {
  
      $('#page1').slideDown();
  });
  </code></pre>
  
  <p>but the following code doesn't seem to work:(trying to pass dynamically)</p>
  
  <pre><code>$('#slidedown').click(function () {
      var name = $(this).attr("name");
      $('#' + name).slideDown();
  });
  </code></pre>
  
  <p>here is my HTML:</p>
  
  <pre><code>&lt;div  id="page1" style="display: none;"&gt;
  &lt;p&gt;Lorem ipsum dolor sit amet1.&lt;/p&gt;
  &lt;/div&gt;&lt;!--end div 1--&gt;
  &lt;div  id="page2" style="display: none;"&gt;
  &lt;p&gt;Lorem ipsum dolor sit amet2.&lt;/p&gt;
  &lt;/div&gt;&lt;!--end div 2--&gt;
  &lt;div  id="page3" style="display: none;"&gt;
  &lt;p&gt;Lorem ipsum dolor sit amet3.&lt;/p&gt;
  &lt;/div&gt;&lt;!--end div 3--&gt;
  &lt;div id="page4" style="display: none;"&gt;
  &lt;p&gt;Lorem ipsum dolor sit amet4.&lt;/p&gt;
  &lt;/div&gt;&lt;!--end div 4--&gt;
  
  &lt;ul class="pagination pagination-lg" id="slidedown"&gt;
  
           &lt;li&gt;&lt;a href="#" name="page1"&gt;1&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="#" name="page2"&gt;2&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="#" name="page3"&gt;3&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="#" name="page4&gt;4&lt;/a&gt;&lt;/li&gt;
  
        &lt;/ul&gt;
  </code></pre>
  
  <p>Is error in passing the variable to jquery?</p>