title: Php for loop Onclick function for each function event
body: <p>I have repost my question again. I have a for loop in my main page which loop through a list of result with show and hide button (onclick function). Whenever I click on the any of show() button, all my div.view slide down togather and when I click on hide() button, all my div.vew slide up togather. I would like to have each show() corresponding to each div.view tag. I sorry about my bad english and repost the question again due lack of experience in my coding. Would appreciate if anyone can help me here. thanks alot.  </p>
  
  <p>Hide
  <a href="https://i.stack.imgur.com/Ulm6j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ulm6j.png" alt="enter image description here"></a></p>
  
  <p>show
  <a href="https://i.stack.imgur.com/EfNXG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EfNXG.png" alt="enter image description here"></a></p>
  
  <pre><code>   &lt;?php
     for( $i = 0; $i &lt; count($db); $i++)
     {   
     &lt;div class="view"&gt;
     &lt;?php
     echo $data["Description"];
     ?&gt;
     &lt;/div&gt;
  
  
      &lt;div style="float:right; margin:0px 8px 0px 0px;"&gt;
      &lt;div onClick="show()" style="cursor:pointer; font-size:12px; color:#8080FF; float:left;"&gt;Show&amp;nbsp;&lt;div style="color:#FFF; font-weight:bold; float:right;"&gt;/&lt;/div&gt;&lt;/div&gt;
      &lt;div onClick="hide()" style="cursor:pointer; font-size:12px; color:#8080FF; float:right;"&gt;&amp;nbsp;Hide&lt;/div&gt;
      &lt;/div&gt;
  
     }
     ?&gt; 
  </code></pre>
  
  <p>search.js</p>
  
  <pre><code>   function show() 
     {    
     $('div.view').animate({height:160},500);
     }
  
     function hide() 
     {
     $('div.view').animate({height:40},500);
     }
  </code></pre>