Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7679789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:57:32+00:00 2026-05-31T17:57:32+00:00

I am new to jQuery and have run into a problem. I have a

  • 0

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.

My html:

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

        <div class="clear"></div>

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

And the jQuery

$(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);}
);
});

I would be very greatful if someone could help me with this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:57:35+00:00Added an answer on May 31, 2026 at 5:57 pm

    By animating $('.DocumentDetails'), you’re targeting all instances of that class. Instead, use the this variable (and some DOM traversal) to target only the results being clicked:

    jQuery('.toggle').toggle(
        function () {$(this).closest('.Document').find('.DocumentDetails').animate({opacity:'toggle'}, 500);},
        function () {$(this).closest('.Document').find('.DocumentDetails').animate({opacity:'toggle'}, 500);}
    );
    

    http://jsfiddle.net/jESaE/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to javascript and jquery, and have run into a problem that
I am brand new to Jquery and have run into something that if answered
I've been editing a JQuery plugin 'airport' and have run into a problem; I
I am somewhat new to jQuery and I have a problem with something I
I have application that brings response via Ajax and creates 5-20 new jQuery click
Ok, I am new to JQuery, I have a modal that has a asp:Literal
OK, I'm totally new to .NET MVC3 and I've run into a problem. I
I'm currently porting a jQTouch web project to jQuery Mobile and have run into
While working with some jQuery ajax, I've run into this problem with Chrome and
I'm pretty new to javascript and programming and have run into a brick wall

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.