title: Hide/show div with javascript and while loop
body: <p>I am trying for hours now and for some reason i can't find a solution for my problem.
  The thing is, i need something like a div thats showing up when i click on an link. 
  That's working so far. </p>
  
  <p>But the main problem is, that i need it work within a while loop. So i can get the data dynamically into grid, but all of the php created links have the same id and all of the "to-show-divs" show up at the same time. so my question is how can i create dynamic ids or classes and how do i get them to work within javascript?</p>
  
  <pre><code>echo "&lt;div class='grid grid-pad'&gt;";
  $db=mysql_query("SELECT * FROM work") or die (mysql_error());
  while($var=mysql_fetch_array($db))
  {         
      echo "&lt;div class='col-1-3'&gt;
                &lt;div class='content'&gt;
                    &lt;div id='thumb' &gt;&lt;img alt='$var[id]' src='$var[thumb]'/&gt;&lt;/div&gt;
                    &lt;div class='menu' style='display: none;'&gt;$var[link]&lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;";
  }
  
  echo "&lt;/div&gt;";
  
  &lt;script&gt;
      $(document).ready(function() {
          $('#thumb').click(function() {
              $('.menu').slideToggle("fast");
          });
      });
  &lt;/script&gt;
  </code></pre>