title: passing parameters to dynamic drop down function jquery
body: <p>I have a for loop which generates few 'a' tag buttons and few divisions. I am trying to write a function in which with a toggle effect. If I click on a specific a tag only the corresponding div tag should get toggled. I am trying to pass a dynamic value to this function but it doesn't work. Here is the code. Please help. Thank you.</p>
  
  <pre><code>&lt;html&gt;
  &lt;header&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;link href="layout.css" rel="stylesheet" type="text/css"&gt;
  &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;style type="text/css"&gt; 
  .hideonly
  {
  padding:50px;
  display:none;
  }
  &lt;/style&gt;
  &lt;/header&gt;
  &lt;body&gt;
  &lt;?php
  $num_row = 5; //dynamic value
  $i = 0;
  $header_title = "";
      for ($i=0;$i&lt;$num_row;$i++)
        {
          $header_title = $i; // Displaying all the headers and menus for the hotel.
          echo "&lt;div&gt;";
          echo "&lt;br&gt;";
          echo "&lt;a class = \"menu-header-2\" href=\"#\"&gt;$header_title&lt;/a&gt;";
          echo "&lt;div id = \".$i.\" class = \"hideonly\" &gt;Hello World!&lt;/div&gt;";
          echo "&lt;br&gt;";
          echo "&lt;/div&gt;";
        } 
  ?&gt;
  &lt;/body&gt;
  &lt;script&gt; 
  $(document).ready(function(){
    $(".menu-header-2").click(function($i){
      $("#" . $i).slideToggle("fast");
    });
  });
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>