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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:14:33+00:00 2026-05-30T20:14:33+00:00

Possible Duplicate: How to show/hide a div on mouseover using jquery? I have a

  • 0

Possible Duplicate:
How to show/hide a div on mouseover using jquery?

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 class = "popup">
              <div class="Month">
                    <div class="MonthDiv">
                        <span class="MonthText">'.$testcontent[0].'</span>
                    </div>
              </div>
              <div class='Day'>
                    <div class="DayDiv">
                        <span class="DayText">'.$testcontent[1].'</span>
                    </div>
              </div>
              <div class='Time'>
                    <div class="TimeDiv">
                        <span class="TimeText">'.$testcontent[2].'</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();            
    }, function() {
       $('.popup').hide();
    });

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

reference: I used this link to display 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?

I even tried with

$('.trigger').hover(function(e) {
   $('.MonthText').html($(this).html());
   $('.popup').show();
}

The css for the popup is …

div.popup {
    display: none;
    position: absolute;
    width: 640px;
    padding: 10px;
    background:#FFFFFF;
    color: #000000;
    border: 1px solid #1a1a1a;
    font-size: 90%;
    height:400px;
}

Now the div changes with the value where the mouse points
I need to get the entire row value to get changed….(I mean i need to reload the entire div)
I have been working on this for a long time.
Please help me…
Changes Made: I replaced the popup id with the class, but still getting the same result.

  • 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-30T20:14:34+00:00Added an answer on May 30, 2026 at 8:14 pm

    All your popup divs have same I’d so ideally jQuery will pick up the first one. Trying adding an attribute on your .trigger element and popup div that indicate which div it should popup (can use the index from loop). Then in hover event you can show the correct popup using that attribute value.

    I’m typing from a phone so do not have sample code. Let me know if you understand this else I can provide a sample

    Edit: A different sample below

    $(document).ready(function(){
        $('.trigger').click(function(){
            $(this).parent().children('.popup').show();
        });
    }); 
    

    Let me know if this works. The above answer from @abhijeet-pawar should also work ideally

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

Sidebar

Related Questions

Possible Duplicate: JS/jQuery (Hide div, show div on click) I'm new to web development
Possible Duplicate: Show and hide divs at a specific time interval using jQuery I
Possible Duplicate: JQuery Show hide class on hover just like stackoverflow, when you hover
Possible Duplicate: How can I use delay() with show() and hide() in Jquery How
Possible Duplicate: Adding show/hide to my div tags the hide/show div tags is not
Possible Duplicate: Hide select option in IE using jQuery So as you can see
Possible Duplicate: Format Date in Bind Statement inside a ListView I have modified a
Possible Duplicate: Android: ProgressDialog.show() crashes with getApplicationContext I want to have a progress dialog
Possible Duplicate: Show the original branch for a commit git version 1.7.4.1 I have
Possible Duplicate: how-to-align-a-div-to-the-middle-of-the-page I need to show this Div tag allways center of the

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.