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 6556289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:55:33+00:00 2026-05-25T12:55:33+00:00

Im trying to animate some elements with jQuery. The elements have the same classes

  • 0

Im trying to animate some elements with jQuery.
The elements have the same classes and id’s since the info in the elements are ‘fetched’ from a database.

My problem is that when i click on the elements, all of the hidden things pop up, and i want to only show the user clicked’s information. Not all of them.

In the head i got this:

<script> 
    $(document).ready(function() {
        $("#new_user").click(function() {
            $(".new_users_box").animate({height: 'toggle' });
        });
    });
</script>

What i am animating is this:

while ($row = mysql_fetch_array($result))
{
    $thumb1 = $row['user_thumb1'];
    $new_id = $row['id'];
    $new_user = $row['username'];

    echo '<a id="new_user" class="box_round"
             style="background-color:#101010 !important;">'.$new_user.'</a>
          <div class="box_newest new_users_box" style="display:none;">
             <p>'.$new_user.'</p>
          </div>';
}

Does anyone know how i can fix 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-25T12:55:34+00:00Added an answer on May 25, 2026 at 12:55 pm

    You should be referring to $(this) instead of $('.new_users_box') inside your click handler. $(this) will select the element that triggered the event whereas selecting a class (everything marked by a . in front) will probably select a couple of elements (which is why it will show you all of them in your case).

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

Sidebar

Related Questions

hi i am playing with jquery ui effects and trying to animate some christmas
I am trying to animate menu elements shrinking the width from 170 to 150px
I have a set of path elements that I'm trying to scale with animation.
I'm trying to animate a block level element using jQuery. The page loads with
I'm trying to animate a dot from one point to another on a map.
I am using flot to do some graphing and I am trying to animate
I'm trying to add some iPhone style scrolling inertia to a web page that
I'm trying to animate object. I use keyframe animation: I have two vertex buffers
I'm trying to move some elements on the page, and during the time the
I'm trying to animate the alpha transitions of some NSViews. It needs to happen

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.