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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:49:19+00:00 2026-05-30T18:49:19+00:00

I have a foreach loop inside a table to display the content from DB

  • 0

I have a foreach loop inside a table to display the content from DB dynamically.

<table cellpadding="3" cellspacing="0" align="center">

<?php 
    foreach($test as $testcontent){
                    echo  '<tr>';
        echo '<td class="trigger">'.$testcontent[0].'</td>';
        echo '<td class="trigger">'.$testcontent[1].'</td>';
        echo '<td class="trigger">'.$testcontent[2].'</td>';
        echo '<div id = popup style="display:none">
                <div class="Month">
                        <div class="MonthDiv">
                            <span class="MonthText">'.$testcontent[0].'</span>
                        </div>
                </div>
            </div>';
            echo '</tr>';
    }
?>
</table>

Function to show/hide the popup is as followed…

$(function() {
var moveLeft = 20;
var moveDown = 10;

$('.trigger').hover(function(e) {
  $('#popup').show();
    //.css('top', e.pageY + moveDown)
    //.css('left', e.pageX + moveLeft)
    //.appendTo('body');
}, function() {
  $('#popup').hide();
});

$('.trigger').mousemove(function(e) {
  $("#popup").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
});

});

reference: I used this link for popup

The popup shows up but the problem is when i move the mouse over the 2nd, 3rd…. row, only the content of the first row is shown in the popup.
I don’t know why. Can any one help me in 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-30T18:49:20+00:00Added an answer on May 30, 2026 at 6:49 pm

    This is because in your code don´t change the content of the div popup.

    $('.trigger').hover(function(e) {
      // Change the content of popup
       $('.MonthText').html($(this).html());
       // Later show the popup
      $('#popup').show();
        //.appendTo('body');
    }, function() {
      $('#popup').hide();
    });
    

    I hope this helps 🙂

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

Sidebar

Related Questions

print '<div id=wrap>'; print <table width=\100%\ border=\0\ align=\center\ cellpadding=\3\ cellspacing=\3\>; for($i=0; $i<count($news_comments); $i++) {
i want to have a foreach loop where the initial array is changed inside
I have a Parallel.ForEach loop running an intensive operation inside the body. The operation
i have two foreach loop to display some data, but i want to use
I have a function which performs a foreach loop on an array from a
I have a question regarding db queries inside of a foreach loop. Im making
I have a foreach loop in a view that display a list of files
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
In Java 5 and above you have the foreach loop, which works magically on
in a ASP.NET application (MVC) I have a foreach loop that loops through a

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.