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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:31:48+00:00 2026-06-14T15:31:48+00:00

i need help about this JQuery code again i really have a little experience

  • 0

i need help about this JQuery code again i really have a little experience with JQuery so sorry if the question is a mess..
ill credit http://www.w3schools.com for this one since i copied it from them

//the JS code
$(document).ready(function(){
$(".flip").click(function(){
    $(".panel").slideToggle("slow");
  });
});

<p class="flip">click to view full credit report details</p>
<div class='panel'>                              
 <?php                          
   display_column_name($table_name,$table_id);
 ?>
</div>

ok so the code is actually looped it repeats depending on how many data i have in my database so the problem right now is when i click on “Click to view full credit report details” it opens everything.. what i want is when i click on that it only opens that portion… and not the others… any idea about this? i really need help thanks 🙂

  • 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-06-14T15:31:50+00:00Added an answer on June 14, 2026 at 3:31 pm

    You should have dynamic id for each p element. which calls div with another dynamically setted id.

    in your loop you could do like this

    $(document).ready(function(){
    $("#flip_<?php echo $id_from_database;?>").click(function(){
        $("#panel_<?php echo $id_from_database;?>").slideToggle("slow");
      });
    });
    

    and your html, this should be within loop as well

    <p id="flip_<?php echo $id_from_database;?>">click to view full credit report details</p>
    <div id='panel_<?php echo $id_from_database;?>'>                              
     <?php                          
       display_column_name($table_name,$table_id);
     ?>
    </div>
    

    OR

    Second method

    tHIS CODE INSIDE LOOP

    <p id="flip_<?php echo $id_from_database;?>" onclick="expandDiv('<?php echo $id_from_database;?>')">click to view full credit report details</p>
        <div id='panel_<?php echo $id_from_database;?>'>                              
         <?php                          
           display_column_name($table_name,$table_id);
         ?>
        </div>
    

    javascript function outside loop

    function expandDiv(id){
       $("#panel_"+id).slideToggle("slow");
    }
    

    Where

    $id_from_database is the unique id of the records that come from database.

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

Sidebar

Related Questions

I have one question about Yii framework, and I need your help. Basicly, I
Not exactly about programming, but I need help with this. I'm running a development
I need some help about WCF and authorization. Currently I have a client which
I need some help about RegExp in AS3. I have a simple pattern :
Anyone, I need help, I got a task from my teacher, it's about jquery,
Well, I know absolutely nothing about the subject, so I really need help. I
I need some help with PHP Class. I have limited knowledge about how it
This may sound impossible but read on. I need to learn jQuery a little
This is about the (mootools-like) kwicks Jquery plugin: http://www.jeremymartin.name/projects.php?project=kwicks I have the same problem
I need a help about keeping my footer height fixed. Full of content and

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.