Use jQuery to toggle dynamic search results
<p>I am new to jQuery and have run into a problem. I have a form that uses php to query a database, then display the result. My idea is to have only a portion of the returned row displayed with a button to display the remaining portions of the returned row. The problem is that when the button is clicked, it the displays the additional fields, but for all results rather than the selected result.</p>

<p>My html:</p>

<pre><code>&lt;div id="DocumentResults"&gt;
&lt;!-- foreach($documents as $document) : --&gt;
    &lt;div class="Document"&gt;
        &lt;div class="DocumentName"&gt;&lt;strong&gt;Product Name&lt;/strong&gt;&lt;/div&gt;&lt;!-- end .DocumentName --&gt;
        &lt;div class="DocumentActions"&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a class="button_link toggle" href="#"&gt;&lt;span&gt;Details&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a class="button_link" href="" target="_blank"&gt;&lt;span&gt;View&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
        &lt;/div&gt;&lt;!-- end .DocumentActions --&gt;

        &lt;div class="clear"&gt;&lt;/div&gt;

        &lt;div class="DocumentDetails"&gt;
            &lt;ul&gt;
                &lt;li&gt;Manufacturer: &lt;/li&gt;
                &lt;li&gt;Product Number(s): &lt;/li&gt;
            &lt;/ul&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
        &lt;/div&gt;&lt;!-- end .DocumentDetails --&gt;
    &lt;/div&gt;      
&lt;?php endforeach; ?&gt;
</code></pre>

<p></p>

<p>And the jQuery</p>

<pre><code>$(document).ready(function() {  
jQuery(".DocumentDetails").hide();

// works but shows details for ALL results.
jQuery('.toggle').toggle(
    function () {$('.DocumentDetails').animate({opacity:'toggle'}, 500);},
    function () {$('.DocumentDetails').animate({opacity:'toggle'}, 500);}
);
});
</code></pre>

<p>I would be very greatful if someone could help me with this.</p>
