title: javascript foreach loop values
body: <p>I am new to this and I am struggling with one thing for such a long time...
  I use foreach loop to show all images in a list, that works fine. </p>
  
  <pre><code>&lt;?php
  foreach($listImages as $image) {
  ?&gt;
      &lt;a href="#" class="show_hide" title="&lt;?php echo $image; ?&gt;" &gt;
          &lt;img src="foto.php?file=&lt;?php echo $image; ?&gt;" alt="building thumb"/&gt;
      &lt;/a&gt;
  &lt;?php
  }
  </code></pre>
  
  <p>Then I use simple show and hide script that looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){ 
      $(".slidingDiv").hide();
      $(".show_hide").show();
      $('.show_hide').click(function(){
          $(".slidingDiv").slideToggle();
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Finally, when I use div slidingDiv, it works as I expect, but I also need to know name of the image I clicked on but I really don't know how to do that. </p>
  
  <pre><code>&lt;div class="slidingDiv"&gt;
  !!! I need to know $image from the foreach loop here !!!
  &lt;/div&gt;
  </code></pre>
  
  <p>Thank you for your help!</p>